|
| auto | parse (int argc, char *argv[]) -> ParseResult< T > |
| | Parses standard C-style argc/argv, using argv[0] as the program name.
|
| auto | parse (T initial, int argc, char *argv[]) -> ParseResult< T > |
| | Parses argc/argv starting from a pre-initialised argument struct.
|
| auto | parse (std::span< const std::string_view > args, std::size_t first_index=0) -> ParseResult< T > |
| | Parses a span of string views, skipping first_index elements.
|
| auto | parse (std::span< const std::string_view > args, std::string_view program_name, std::size_t first_index=0) -> ParseResult< T > |
| | Parses a span with an explicit program name for help output.
|
| auto | parse (T initial, std::span< const std::string_view > args, std::size_t first_index=0) -> ParseResult< T > |
| | Parses a span starting from a pre-initialised argument struct.
|
| auto | parse (T initial, std::span< const std::string_view > args, std::string_view program_name, std::size_t first_index=0) -> ParseResult< T > |
| | Parses a span with a pre-initialised struct and explicit program name.
|
| auto | program_name () const -> const std::string & |
| | Get the program name used in help output.
|
| auto | set_program_name (std::string name) -> void |
| | Set the program name used in help output.
|
| auto | format_help (ColorMode color_mode=ColorMode::detect, HelpPalette palette=default_help_palette) -> std::string |
| | Generates a help string for the argument specification.
|
| auto | format_help (RecurseHelpTag) -> std::string |
| | Generates a help string including recursive subcommand help.
|
| auto | format_help (HelpPalette palette) -> std::string |
| auto | format_help (ColorMode color_mode, RecurseHelpTag) -> std::string |
| | Generates a help string with explicit color mode and recursive subcommand help.
|
| auto | format_help (ColorMode color_mode, HelpPalette palette, RecurseHelpTag) -> std::string |
template<ArgumentSpec T>
struct cli::Parser< T >
The main parsing engine for a typed argument specification.
Parser<T> owns a TokenizerConfig and the program name used in help output. It tokenizes the argument list, dispatches each token to the appropriate field of T, validates required arguments, and fires on_parse callbacks.
Entry points:
- parse(argc, argv) — standard C-style interface; sets program name from argv[0].
- parse(span, first_index) — span-based interface with optional offset.
- parse(initial, ...) — pre-initialised variants; useful for BoundOption / on_parse.
On Windows, use cli::utf16_to_utf8(argc, argv) in wmain and pass the converted UTF-8 argv to the standard char* overload.
- Template Parameters
-
| T | The argument specification type (must satisfy ArgumentSpec). |
Definition at line 736 of file parser.hh.