|
ChainCLI
A modern C++20 command-line interface library
|
Main class representing a command-line application. More...
#include <cli_app.h>
Public Member Functions | |
| CliApp (const CliApp &)=delete | |
| CliApp & | operator= (const CliApp &)=delete |
| CliApp (std::string_view executableName) | |
| CliApp (CliConfig &&config) | |
| CliApp (const CliConfig &config, std::unique_ptr< logging::AbstractLogger > logger) | |
| CliApp & | withCommand (std::unique_ptr< commands::Command > subCommandPtr) |
| Add a new command to the application. | |
| CliApp & | withCommand (commands::Command &&subCommand) |
| Add a new command to the application. | |
| void | init () |
Initialize the CLI application, preparing it for execution This method sets up internal structures and should be called before run() if any commands have been added. If not called explicitly, it will be called automatically on the first invocation of run(). | |
| int | run (int argc, char *argv[]) |
| Run the CLI application with the given arguments. | |
| logging::AbstractLogger & | Logger () |
| Get the logger instance used by the CLI application. | |
| const commands::CommandTree & | getCommandTree () const |
| Get the command tree used by the CLI application. | |
| commands::Command * | getMainCommand () |
| Get the command tree used by the CLI application. | |
| CliConfig & | getConfig () |
| Get the configuration used by the CLI application. | |
| commands::docwriting::DocWriter & | getDocWriter () |
| Get the documentation writer used by the CLI application. | |
| void | setLogger (std::unique_ptr< logging::Logger > &&newLogger) |
| Set the logger instance used by the CLI application. | |
Main class representing a command-line application.
|
inline |
Get the command tree used by the CLI application.
|
inline |
Get the configuration used by the CLI application.
|
inline |
Get the documentation writer used by the CLI application.
|
inline |
Get the command tree used by the CLI application.
|
inline |
Get the logger instance used by the CLI application.
| inline_t int cli::CliApp::run | ( | int | argc, |
| char * | argv[] | ||
| ) |
Run the CLI application with the given arguments.
| argc | the argument count |
| argv | the argument vector |
|
inline |
Set the logger instance used by the CLI application.
| newLogger | the new logger instance |
| inline_t CliApp & cli::CliApp::withCommand | ( | commands::Command && | subCommand | ) |
Add a new command to the application.
| subCommand | the command to add |
| inline_t CliApp & cli::CliApp::withCommand | ( | std::unique_ptr< commands::Command > | subCommandPtr | ) |
Add a new command to the application.
| subCommandPtr | the unique pointer to the command to add |