Skip to main content

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)

Arg add(std::string_view name, ArgType type)

A value option (--name [-n]), typed by type.

Declared in ClikaRT/cli/command.h, line 72

add(string_view, string_view, ArgType)

Arg add(
    std::string_view long_name,
    std::string_view short_name,
    ArgType type
)

Same as add(name, type), with long + short spellings (--device, -d).

Declared in ClikaRT/cli/command.h, line 74

positional()

Arg positional(std::string_view name, ArgType type)

A positional argument (matched by position), typed by type.

Declared in ClikaRT/cli/command.h, line 76

flag(string_view)

Flag flag(std::string_view name)

A boolean switch.

Declared in ClikaRT/cli/command.h, line 78

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 80

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 85

alias()

Command& alias(std::string_view name)

add an alias for THIS command

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

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 90

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.

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

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 97

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 99

Protected member functions

Command()

Command() =default

Declared in ClikaRT/cli/command.h, line 103

Protected data members

node_

detail::CmdNode* node_ = nullptr

Declared in ClikaRT/cli/command.h, line 107