cli20 0.1.2
A C++20 typed-schema command-line parser
Loading...
Searching...
No Matches
cli::Command< Name, T > Struct Template Reference

A named subcommand that nests another argument specification. More...

#include <argument.hh>

Inheritance diagram for cli::Command< Name, T >:
cli::CommandTag cli::SpecMemberTag

Public Types

using argument_type = T

Public Member Functions

 Command ()=default
 Command (CommandParameter param)
auto provided () const -> bool
auto help_text () const -> std::string_view
auto hidden () const -> bool
auto deprecated () const -> std::string_view
auto mark_provided () -> void

Static Public Member Functions

static constexpr auto command_name () -> std::string_view

Static Public Attributes

static constexpr auto name = Name

Detailed Description

template<StringLiteral Name, ArgumentSpec T>
requires requires { detail::is_valid_command_name<Name>(); }
struct cli::Command< Name, T >

A named subcommand that nests another argument specification.

Command inherits from both the argument specification type T (to hold its parsed fields) and CommandTag (so the parser identifies it as a subcommand). Use provided() to check whether the subcommand was actually invoked at runtime.

Template Parameters
NameThe subcommand name (e.g. "build").
TThe argument specification type for the subcommand's own options.

Definition at line 413 of file argument.hh.

Member Typedef Documentation

◆ argument_type

template<StringLiteral Name, ArgumentSpec T>
using cli::Command< Name, T >::argument_type = T

Definition at line 415 of file argument.hh.

Constructor & Destructor Documentation

◆ Command() [1/2]

template<StringLiteral Name, ArgumentSpec T>
cli::Command< Name, T >::Command ( )
default

◆ Command() [2/2]

template<StringLiteral Name, ArgumentSpec T>
cli::Command< Name, T >::Command ( CommandParameter param)
inline

Definition at line 418 of file argument.hh.

Member Function Documentation

◆ command_name()

template<StringLiteral Name, ArgumentSpec T>
constexpr auto cli::Command< Name, T >::command_name ( ) -> std::string_view
inlinestaticconstexpr

Definition at line 423 of file argument.hh.

◆ deprecated()

template<StringLiteral Name, ArgumentSpec T>
auto cli::Command< Name, T >::deprecated ( ) const -> std::string_view
inlinenodiscard

Definition at line 429 of file argument.hh.

◆ help_text()

template<StringLiteral Name, ArgumentSpec T>
auto cli::Command< Name, T >::help_text ( ) const -> std::string_view
inlinenodiscard

Definition at line 427 of file argument.hh.

◆ hidden()

template<StringLiteral Name, ArgumentSpec T>
auto cli::Command< Name, T >::hidden ( ) const -> bool
inlinenodiscard

Definition at line 428 of file argument.hh.

◆ mark_provided()

template<StringLiteral Name, ArgumentSpec T>
auto cli::Command< Name, T >::mark_provided ( ) -> void
inline

Definition at line 432 of file argument.hh.

◆ provided()

template<StringLiteral Name, ArgumentSpec T>
auto cli::Command< Name, T >::provided ( ) const -> bool
inlinenodiscard

Definition at line 426 of file argument.hh.

Member Data Documentation

◆ name

template<StringLiteral Name, ArgumentSpec T>
auto cli::Command< Name, T >::name = Name
staticconstexpr

Definition at line 422 of file argument.hh.


The documentation for this struct was generated from the following file: