18namespace kaycxx::cli {
33 return command_->
name();
101 template <parseable_value T>
103 std::string_view
name,
104 std::string_view value_name,
105 std::optional<std::string_view>
description = std::nullopt
124 template <parseable_value T>
126 std::string_view
name,
128 std::string_view value_name,
129 std::optional<std::string_view>
description = std::nullopt
147 template <parseable_value T>
149 std::string_view
name,
150 std::string_view value_name,
151 std::optional<std::string_view>
description = std::nullopt
170 template <parseable_value T>
172 std::string_view
name,
174 std::string_view value_name,
175 std::optional<std::string_view>
description = std::nullopt
190 template <parseable_value T>
205 template <parseable_value T>
254 : command_(&definition)
Parsed command line arguments.
Definition args.hpp:41
Handle for a registered command.
Definition command_handle.hpp:25
std::optional< std::string > const & description() const noexcept
Returns this command's configured description.
Definition command_handle.hpp:41
args parse(int argc, char *argv[]) const
Parses command-line arguments from this command as the starting command.
Definition command_handle.hpp:218
option_handle< T > option(std::string_view name, char alias, std::string_view value_name, std::optional< std::string_view > description=std::nullopt)
Registers an option with a short alias.
Definition command_handle.hpp:125
parameter_handle< T > parameter(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a single positional parameter.
Definition command_handle.hpp:191
std::string const & name() const noexcept
Returns the command name.
Definition command_handle.hpp:32
int print_help(std::ostream &out=std::cout) const
Writes generated help output.
Definition command_handle.hpp:229
repeatable_option_handle< T > repeatable_option(std::string_view name, std::string_view value_name, std::optional< std::string_view > description=std::nullopt)
Registers a repeatable option without a short alias.
Definition command_handle.hpp:148
repeatable_option_handle< T > repeatable_option(std::string_view name, char alias, std::string_view value_name, std::optional< std::string_view > description=std::nullopt)
Registers a repeatable option with a short alias.
Definition command_handle.hpp:171
flag_handle flag(std::string_view name, char alias, std::optional< std::string_view > description=std::nullopt)
Registers a flag with a short alias.
Definition command_handle.hpp:84
command_handle command(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a child command.
Definition command_handle.hpp:55
flag_handle flag(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a flag without a short alias.
Definition command_handle.hpp:69
option_handle< T > option(std::string_view name, std::string_view value_name, std::optional< std::string_view > description=std::nullopt)
Registers an option without a short alias.
Definition command_handle.hpp:102
int print_version(std::ostream &out=std::cout) const
Writes generated version output.
Definition command_handle.hpp:240
parameters_handle< T > parameters(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a positional parameter list.
Definition command_handle.hpp:206
Common base class for an application and its commands.
Definition command.hpp:45
command_handle add_command(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a child command.
cli::parameter_handle< T > parameter(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a single positional parameter.
Definition command.hpp:212
int print_version(std::ostream &out=std::cout) const
Writes generated version output.
int print_help(std::ostream &out=std::cout) const
Writes generated help output.
cli::args parse(int argc, char *argv[]) const
Parses command line arguments.
std::string const & name() const noexcept
Returns the command name.
cli::parameters_handle< T > parameters(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a positional parameter list.
Definition command.hpp:231
cli::option_handle< T > option(std::string_view name, std::string_view value_name, std::optional< std::string_view > description=std::nullopt)
Registers an option without a short alias.
Definition command.hpp:109
cli::repeatable_option_handle< T > repeatable_option(std::string_view name, std::string_view value_name, std::optional< std::string_view > description=std::nullopt)
Registers a repeatable option without a short alias.
Definition command.hpp:161
cli::flag_handle flag(std::string_view name, std::optional< std::string_view > description=std::nullopt)
Registers a flag without a short alias.
std::optional< std::string > const & description() const noexcept
Returns this command's configured description.
Handle for a registered flag.
Definition flag_handle.hpp:22
Handle for a registered option.
Definition option_handle.hpp:25
Defines the common command base class.