ClikaRT::cli::App
class
Header: ClikaRT/cli/command.h
Inherits: ClikaRT::cli::Command
The application root: a command plus the parse/run entry points, version, help/usage/completion text, and injectable output/error streams. Owns the parser; move-only.
Member functions
App(string_view, string_view)
explicit App(std::string_view program, std::string_view description = {})
The root app: program is the display name in usage/help; description heads the help text.
Declared in ClikaRT/cli/command.h, line 155
App(App)
App(App&&) noexcept
Move-only: transfers the app.
Declared in ClikaRT/cli/command.h, line 157
operator=(App)
Move-assign: transfers the app.
Declared in ClikaRT/cli/command.h, line 159
App(App)
App(const App&) =delete
Declared in ClikaRT/cli/command.h, line 160
operator=(App)
Declared in ClikaRT/cli/command.h, line 161
~App()
~App()
Releases the app.
Declared in ClikaRT/cli/command.h, line 163
version()
App& version(std::string_view v)
The text --version prints; chainable.
Declared in ClikaRT/cli/command.h, line 166
allow_unknown()
App& allow_unknown(bool v = true)
collect unknown options instead of erroring
Declared in ClikaRT/cli/command.h, line 167
wrap_width()
App& wrap_width(int columns)
override the help wrap width
Declared in ClikaRT/cli/command.h, line 168
output()
App& output(std::ostream& os)
where run() prints help/version (default std::cout)
Declared in ClikaRT/cli/command.h, line 169
errors()
App& errors(std::ostream& os)
where run() prints errors (default std::cerr)
Declared in ClikaRT/cli/command.h, line 170
enable_completion()
App& enable_completion()
register the hidden completion <shell> subcommand
Declared in ClikaRT/cli/command.h, line 171
parse()
Args parse(int argc, const char*const* argv)
Parse argv; never prints, never exits, never mutates argv. On a usage error returns a failure Result; sets help_requested()/version_requested() on the result rather than acting on them.
Declared in ClikaRT/cli/command.h, line 177
run()
int run(int argc, const char*const* argv)
Parse, then print help/version/errors to the configured streams and dispatch to the matched handler. Returns the handler's exit code, 0 for help/version, or 2 on a usage error. A handler's failure Result, including a throw contained by detail::contain, raises ClikaRT::Error (caller-side, like every fallible call).
Declared in ClikaRT/cli/command.h, line 184
help_text()
std::string help_text() const
full help for the root command
Declared in ClikaRT/cli/command.h, line 186
help_text(vector<string>)
std::string help_text(const std::vector<std::string>& subcommand_path) const
Full help for the subcommand named by subcommand_path (each element the name of a subcommand at the next level down); falls back to root help if the path names no known subcommand.
Declared in ClikaRT/cli/command.h, line 190
usage_line()
std::string usage_line() const
the one-line usage synopsis
Declared in ClikaRT/cli/command.h, line 191
version_string()
std::string version_string() const
the --version text
Declared in ClikaRT/cli/command.h, line 192
completion_script()
std::string completion_script(Shell shell) const
A completion script for shell; source it in the shell's rc.
Declared in ClikaRT/cli/command.h, line 194
program()
std::string_view program() const
the program display name
Declared in ClikaRT/cli/command.h, line 195