ClikaRT::cli::Command
class
Header: ClikaRT/cli/command.h
Inherited by: ClikaRT::cli::App
A node in the command tree. Owns nothing itself (a non-owning handle into the App); declares typed options / positionals / flags / subcommands. Options declared on an ancestor resolve from any descendant.
Member functions
add(string_view, ArgType)
A value option (--name [-n]), typed by type.
Declared in ClikaRT/cli/command.h, line 74
add(string_view, string_view, ArgType)
Same as add(name, type), with long + short spellings (--device, -d).
Declared in ClikaRT/cli/command.h, line 76
positional()
A positional argument (matched by position), typed by type.
Declared in ClikaRT/cli/command.h, line 78
flag(string_view)
Flag flag(std::string_view name)
A boolean switch.
Declared in ClikaRT/cli/command.h, line 80
flag(string_view, string_view)
Flag flag(std::string_view long_name, std::string_view short_name)
Same as flag(name), with long + short spellings.
Declared in ClikaRT/cli/command.h, line 82
command()
Command command(std::string_view name, std::string_view help = {})
A subcommand. Registers name (its help line rides the listing); returns the subcommand's own builder.
Declared in ClikaRT/cli/command.h, line 87
alias()
Command& alias(std::string_view name)
add an alias for THIS command
Declared in ClikaRT/cli/command.h, line 88
hidden()
Command& hidden(bool v = true)
Hide THIS command from help text and completion scripts. It still parses and dispatches by name; hidden governs advertisement only, for verbs an application surfaces through a contextual help of its own.
Declared in ClikaRT/cli/command.h, line 92
handler()
Command& handler(CommandHandler fn)
The handler App::run dispatches to when THIS command matches. A throwing handler is contained caller-side (see detail::contain) and becomes the run's failure result. An empty handler clears the one set before: App::run then shows the help of a command that has subcommands and returns 0 for one that has none.
Declared in ClikaRT/cli/command.h, line 98
group()
Group group(std::string_view title)
A display-only help section; options added through it parse identically.
Declared in ClikaRT/cli/command.h, line 101
exclusive()
ExclusiveGroup exclusive(bool required = false)
A mutually-exclusive constraint: at most one member (exactly one if required).
Declared in ClikaRT/cli/command.h, line 103
Protected member functions
Command()
Command() =default
Declared in ClikaRT/cli/command.h, line 107
Protected data members
node_
detail::CmdNode* node_ = nullptr
Declared in ClikaRT/cli/command.h, line 111