|
ReXGlue SDK
|
#include <rex/cli.h>
Public Member Functions | |
| bool | Has (std::string_view name) const |
| std::optional< std::string_view > | Get (std::string_view name) const |
| std::span< const CLIOption > | GetOptions () const |
| std::span< const std::string > | GetPositionals () const |
| std::span< const std::string > | GetAll () const |
Static Public Member Functions | |
| static CLIArgList | Parse (i32 argc, char **argv) |
| static CLIArgList | Parse (std::span< const std::string > args) |
The command line, split into options and positional arguments. An option is –name or –name=value, and a token after –name that does not start with – is its value.
| std::optional< std::string_view > rex::CLIArgList::Get | ( | std::string_view | name | ) | const |
Reads the value of an option.
| name | Option name without the leading dashes. |
| std::span< const std::string > rex::CLIArgList::GetAll | ( | ) | const |
| std::span< const CLIOption > rex::CLIArgList::GetOptions | ( | ) | const |
Returns the options in the order given. Each option has a name and a value if it has one.
| std::span< const std::string > rex::CLIArgList::GetPositionals | ( | ) | const |
Returns the arguments that are not options or option values.
| bool rex::CLIArgList::Has | ( | std::string_view | name | ) | const |
Reports whether an option is present.
| name | Option name without the leading dashes. |
|
static |
Parses the command line main receives.
| argc | Argument count, including the program name. |
| argv | Argument vector. argv[0] is the program name and is skipped. |
|
static |
Parses command line arguments held as strings.
| args | Command line arguments without the program name. |