|
CPGen
C++ project generator
|
Stateful command-line parser that converts argv into a Config.
More...
#include <CLI.hpp>
Public Member Functions | |
| Config | parse (int argc, char **argv) |
| Parse command-line arguments into a typed configuration. | |
Stateful command-line parser that converts argv into a Config.
Each parse call resets the internal ProjectConfig accumulator, so a single CLI instance can safely be reused across multiple test invocations.
Supported flags:
| Short | Long | Description |
|---|---|---|
-h | --help | Print usage and exit. |
-u | --tui | Return true to trigger TUI mode. |
-n | --name | Project name (must match ^\w +$). |
-p | --path | Target directory (must exist on disk). |
-s | --std | C++ standard: 17, 20, or 23. |
-m | --modules | Comma-separated dependency modules. |
-tar | --targets | Comma-separated target types. |
-g | --git | Enable Git initialisation. |
-cf | --clang-format | Enable clang-format file generation. |
-cfp | --cf-preset | clang-format style preset name. |
-ct | --clang-tidy | Enable clang-tidy file generation. |
| Config CLI::parse | ( | int | argc, |
| char ** | argv | ||
| ) |
Parse command-line arguments into a typed configuration.
Iterates over argv entries in order and dispatches each recognised flag to the appropriate private helper. Unknown flags are silently skipped.
| argc | Number of argument strings in argv. |
| argv | Null-terminated array of argument strings (standard C main signature). |
true if --tui was requested. | std::runtime_error | When a required flag argument is missing, the path does not exist, or the name does not match the required pattern. |
| std::range_error | When the C++ standard value is not 17, 20, or 23. |
