|
cli11
|
Decomposition of command-line arguments and name specifications. More...
import cli11:string_tools;import std;Classes | |
| struct | cli::detail::split_result_t |
| One argument pulled apart into a name and the text following it. More... | |
| struct | cli::detail::option_names_t |
| The names extracted from a name specification, sorted by kind. More... | |
Functions | |
| auto | cli::detail::split_short (const std::string ¤t) -> std::optional< split_result_t > |
| Splits a short-form argument such as -fvalue. | |
| auto | cli::detail::split_long (const std::string ¤t) -> std::optional< split_result_t > |
| Splits a long-form argument such as --file=value. | |
| auto | cli::detail::split_windows_style (const std::string ¤t) -> std::optional< split_result_t > |
| Splits a Windows-style argument such as /file:value. | |
| auto | cli::detail::split_names (std::string current) -> std::vector< std::string > |
| Splits a comma-separated name specification, trimming each entry. | |
| auto | cli::detail::get_default_flag_values (const std::string &str) -> std::vector< std::pair< std::string, std::string > > |
| Extracts the default values written into a flag specification. | |
| auto | cli::detail::get_names (const std::vector< std::string > &input, bool allow_non_standard=false) -> option_names_t |
| Sorts a name specification into short, long, and positional names. | |
Decomposition of command-line arguments and name specifications.
Two separate jobs live here. The split_* functions take one argument off the command line and pull it apart into a name and a value. The get_names and get_default_flag_values functions take a name specification as written by the caller — something like "-f,--file,filename" — and work out what was meant.
|
nodiscardexport |
Extracts the default values written into a flag specification.
Recognises name{value} for an explicit default and a leading ! for a negated flag, which defaults to "false". Entries carrying neither are skipped.
| str | The flag specification, for example "--flag{7},!--no-flag". |
|
nodiscardexport |
Sorts a name specification into short, long, and positional names.
| input | The individual names, as produced by split_names. |
| allow_non_standard | Accept multi-character short names such as -abc. |
| cli::bad_name_string_t | If a name is malformed, reserved, or if more than one positional name is given. |
|
nodiscardexport |
Splits a long-form argument such as --file=value.
| current | The argument to split. |
current is not a long-form argument. The value is empty when there is no =.
|
nodiscardexport |
Splits a comma-separated name specification, trimming each entry.
| current | The specification to split. |
|
nodiscardexport |
Splits a short-form argument such as -fvalue.
| current | The argument to split. |
current is not a short-form argument.
|
nodiscardexport |
Splits a Windows-style argument such as /file:value.
| current | The argument to split. |
current is not a Windows-style argument. The value is empty when there is no :.