#include <ttauri/CommandLineParser.hpp>
|
|
| CommandLineParser (std::string synopsis) |
| |
| void | add (std::string name, datum_type_t type, std::string help, std::function< int(std::string_view)> enum_conversion={}) noexcept |
| | Add a configuration option.
|
| |
| bool | has_error () const noexcept |
| | check if an error has occured during parsing.
|
| |
| void | print_help () |
| | Print help text for the command line arguments.
|
| |
| datum | parse (int argc, char const *const argv[]) noexcept |
| | Parse the arguments.
|
| |
A parser to parse command line arguments.
◆ add()
Add a configuration option.
- Parameters
-
| name | Name of the option. Excluding the leading dashes |
| type | Type of the option's argument |
| help | Description text of the option. |
| enum_conversion | A function that converts a string to an integer. |
◆ has_error()
| bool tt::CommandLineParser::has_error |
( |
| ) |
const |
|
inlinenoexcept |
check if an error has occured during parsing.
◆ parse()
| datum tt::CommandLineParser::parse |
( |
int | argc, |
|
|
char const *const | argv[] ) |
|
inlinenoexcept |
Parse the arguments.
The result will be a map of option/value pairs. Special options are:
- 'executable-path' The path to the exectuable.
- 'arguments' A list of strings of the non-option arguments.
- Parameters
-
| arguments | a list of command line arguments, including the exectable name as the first argument. |
- Returns
- The result as a map-datum, with option names as the keys.
◆ print_help()
| void tt::CommandLineParser::print_help |
( |
| ) |
|
|
inline |
Print help text for the command line arguments.
This will also print any error messages that happened during the parsing.
The documentation for this class was generated from the following file: