Skip to main content

ClikaRT::cli::Arg

class

Header: ClikaRT/cli/arg.h

A typed option or positional handle. Fluent setters return *this; each configures the underlying declared option through the parser. Non-owning; valid while the owning App lives.

Member functions

help()

Arg& help(std::string_view text)

The help line shown for this option; chainable.

Declared in ClikaRT/cli/arg.h, line 81

default_value()

Arg& default_value(std::string_view value)

Value used when the option is absent (parsed from this text at the option's declared type).

Declared in ClikaRT/cli/arg.h, line 84

implicit_value()

Arg& implicit_value(std::string_view value)

Value used when the option is given with no argument (e.g. --jobs).

Declared in ClikaRT/cli/arg.h, line 86

required()

Arg& required(bool v = true)

Mark required; parsing fails when the option is absent; chainable.

Declared in ClikaRT/cli/arg.h, line 88

metavar()

Arg& metavar(std::string_view name)

The value placeholder shown in usage (e.g. PATH); chainable.

Declared in ClikaRT/cli/arg.h, line 90

env()

Arg& env(std::string_view name)

Environment variable consulted when the option is absent from argv.

Declared in ClikaRT/cli/arg.h, line 92

multiple()

Arg& multiple(bool v = true)

Accept the option more than once (collect all occurrences).

Declared in ClikaRT/cli/arg.h, line 94

delimiter()

Arg& delimiter(char d)

Split a single argument into several values on d (e.g. -I a,b,c).

Declared in ClikaRT/cli/arg.h, line 96

choices()

Arg& choices(std::initializer_list<std::string_view> values)

Restrict accepted values to this set (compared at the declared type).

Declared in ClikaRT/cli/arg.h, line 98

conflicts_with()

Arg& conflicts_with(std::string_view other)

Mutual exclusion with option other; both present is a usage error.

Declared in ClikaRT/cli/arg.h, line 100

needs()

Arg& needs(std::string_view other)

Require option other whenever this one is present.

Declared in ClikaRT/cli/arg.h, line 102

hidden()

Arg& hidden(bool v = true)

Hide from help/usage (still parsed); chainable.

Declared in ClikaRT/cli/arg.h, line 104

alias()

Arg& alias(std::string_view name)

An additional accepted spelling; chainable.

Declared in ClikaRT/cli/arg.h, line 106

validator()

Arg& validator(Validator fn)

Reject values your callback disapproves of (e.g. a numeric range, a format). Runs after type-parsing and choices. A throwing validator is contained caller-side (see detail::contain) and becomes a failure.

Declared in ClikaRT/cli/arg.h, line 110