ClikaRT::cli::Args
class
Header: ClikaRT/cli/arg.h
The parsed result. Typed reads re-parse the retained token, so the read type is independent of how the option was declared; a wrong-category read returns a failure Result. Owns its state; move-only. Valid while the owning App lives (it references the matched command).
Member functions
Args(Args)
Args(Args&&) noexcept
Move-only: transfers the parse result.
Declared in ClikaRT/cli/arg.h, line 150
operator=(Args)
Move-assign: transfers the parse result.
Declared in ClikaRT/cli/arg.h, line 152
Args(Args)
Args(const Args&) =delete
Declared in ClikaRT/cli/arg.h, line 153
operator=(Args)
Declared in ClikaRT/cli/arg.h, line 154
~Args()
~Args()
Releases the parse result.
Declared in ClikaRT/cli/arg.h, line 156
get_string()
std::string get_string(std::string_view name) const
The option's value as text (a repeated option reads its LAST value; get_strings reads them all).
Throws
ClikaRT::Error: when the option is unknown or produced no value (guard withhas).
Declared in ClikaRT/cli/arg.h, line 162
get_int()
std::int64_t get_int(std::string_view name) const
The value re-parsed as a signed 64-bit integer.
Throws
ClikaRT::Error: when the option is unknown, produced no value, or its text does not parse as an integer.
Declared in ClikaRT/cli/arg.h, line 167
get_float()
double get_float(std::string_view name) const
The value re-parsed as a double.
Throws
ClikaRT::Error: when the option is unknown, produced no value, or its text does not parse as a number.
Declared in ClikaRT/cli/arg.h, line 172
get_bool()
bool get_bool(std::string_view name) const
The value re-parsed as a boolean.
Throws
ClikaRT::Error: when the option is unknown, produced no value, or its text does not parse as a boolean.
Declared in ClikaRT/cli/arg.h, line 176
get_strings()
std::vector<std::string> get_strings(std::string_view name) const
Every value of a .multiple() (repeated) or .delimiter() (comma-split) option, in order, where get_string reads only the last. A flag yields {"1"}. Raises ClikaRT::Error if the option is unknown or was not provided (guard with has(name)).
Declared in ClikaRT/cli/arg.h, line 183
has()
bool has(std::string_view name) const
Declared AND produced a value (from argv, env, or default).
Declared in ClikaRT/cli/arg.h, line 188
count()
std::size_t count(std::string_view name) const
Times the option occurred on the command line (0 if unknown).
Declared in ClikaRT/cli/arg.h, line 190
subcommand()
std::string subcommand() const
The subcommand that ran (empty for the root) and the full chain to it.
Declared in ClikaRT/cli/arg.h, line 193
subcommand_path()
std::vector<std::string> subcommand_path() const
The full subcommand chain, outermost first (empty at the root).
Declared in ClikaRT/cli/arg.h, line 195
unknown()
std::vector<std::string> unknown() const
unrecognized tokens (with allow_unknown)
Declared in ClikaRT/cli/arg.h, line 197
remaining()
std::vector<std::string> remaining() const
verbatim tokens after a lone --
Declared in ClikaRT/cli/arg.h, line 198
help_requested()
bool help_requested() const
True when help was requested (--help).
Declared in ClikaRT/cli/arg.h, line 201
version_requested()
bool version_requested() const
True when the version was requested (--version).
Declared in ClikaRT/cli/arg.h, line 203