#include <SubCommand.h>
Public Member Functions | |
| SubCommand (const SubCommand &)=delete | |
| SubCommand (SubCommand &&)=delete | |
| SubCommand & | operator= (const SubCommand &)=delete |
| SubCommand & | operator= (SubCommand &&)=delete |
| virtual | ~SubCommand () |
| std::string | getName () const |
| std::string | version () const |
| CLI::Option * | setConfig (const std::string &defaultConfigFile) const |
| CLI::Option * | setLogFile (const std::string &defaultLogFile) const |
| CLI::Option * | setVersionFlag (const std::string &version) const |
| bool | hasParent () const |
| SubCommand * | getParent () const |
| SubCommand * | allowExtras (bool allow=true) |
| SubCommand * | required (bool required=true, bool force=true) |
| SubCommand * | required (SubCommand *subCommand, bool required=true) |
| SubCommand * | required (CLI::Option *option, bool required=true) |
| bool | getRequired () const |
| SubCommand * | needs (SubCommand *subCommand, bool needs=true) |
| SubCommand * | disabled (SubCommand *subCommand, bool disabled=true) |
| SubCommand * | setRequireCallback (const std::function< void(void)> &callback) |
| SubCommand * | finalCallback (const std::function< void()> &finalCallback) |
| std::string | configToStr () const |
| std::string | help (const CLI::App *helpApp, const CLI::AppFormatMode &mode) const |
| void | addSubCommandApp (std::shared_ptr< utils::AppWithPtr > subCommand) |
| template<typename NewSubCommand, typename... Args> | |
| NewSubCommand * | newSubCommand (Args &&... args) |
| template<typename RequestedSubCommand> | |
| RequestedSubCommand * | getSubCommand () |
| template<typename RequestedSubCommand> | |
| RequestedSubCommand * | getSubCommand () const |
| CLI::Option * | getOption (const std::string &name) const |
| CLI::Option * | addOption (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const |
| template<typename ValueTypeT> | |
| CLI::Option * | addOption (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const |
| template<typename ValueTypeT> | |
| CLI::Option * | addOptionVariable (const std::string &name, ValueTypeT &variable, const std::string &description, const std::string &typeName, const CLI::Validator &additionalValidator) const |
| template<typename ValueTypeT> | |
| CLI::Option * | addOptionVariable (const std::string &name, ValueTypeT &variable, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &additionalValidator) const |
| CLI::Option * | addOptionFunction (const std::string &name, const std::function< void(const std::string &)> &callback, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const |
| template<typename ValueTypeT> | |
| CLI::Option * | addOptionFunction (const std::string &name, const std::function< void(const std::string &)> &callback, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const |
| CLI::Option * | addFlag (const std::string &name, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const |
| template<typename ValueTypeT> | |
| CLI::Option * | addFlag (const std::string &name, const std::string &description, const std::string &typeName, ValueTypeT defaultValue, const CLI::Validator &validator) const |
| CLI::Option * | addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const CLI::Validator &validator) const |
| CLI::Option * | addFlagFunction (const std::string &name, const std::function< void()> &callback, const std::string &description, const std::string &typeName, const std::string &defaultValue, const CLI::Validator &validator) const |
Protected Member Functions | |
| SubCommand (SubCommand *parent, std::shared_ptr< utils::AppWithPtr > appWithPtr, const std::string &group, bool final=false) | |
| template<typename ConcretSubCommand> | |
| SubCommand (SubCommand *parent, ConcretSubCommand *concretSubCommand, const std::string &group, bool final=false) | |
| void | parse (int argc, char *argv[]) const |
| SubCommand * | description (const std::string &description) |
| SubCommand * | footer (const std::string &footer) |
| void | removeSubCommand () |
| template<typename ValueTypeT> | |
| CLI::Option * | setDefaultValue (CLI::Option *option, const ValueTypeT &value, bool clear=true) const |
| CLI::Option * | setConfigurable (CLI::Option *option, bool configurable) const |
Static Protected Member Functions | |
| static CLI::App * | getHelpTriggerApp () |
| static CLI::App * | getShowConfigTriggerApp () |
| static CLI::App * | getCommandlineTriggerApp () |
Protected Attributes | |
| CLI::Option * | helpOpt = nullptr |
Static Protected Attributes | |
| static std::shared_ptr< CLI::Formatter > | sectionFormatter = makeSectionFormatter() |
| static std::map< std::string, std::string > | aliases |
| static CLI::App * | helpTriggerApp = nullptr |
| static CLI::App * | showConfigTriggerApp = nullptr |
| static CLI::App * | commandlineTriggerApp = nullptr |
Private Member Functions | |
| CLI::Option * | initialize (CLI::Option *option, const std::string &typeName, const CLI::Validator &validator, bool configurable) const |
Private Attributes | |
| AppWithPtr * | subCommandApp |
| std::string | name |
| SubCommand * | parent |
| std::shared_ptr< AppWithPtr > | selfAnchoredSubCommandApp |
| std::set< SubCommand * > | childSubCommands |
| bool | final |
| CLI::Option * | showConfigOpt = nullptr |
| CLI::Option * | commandlineOpt = nullptr |
| int | requiredCount = 0 |
Definition at line 97 of file SubCommand.h.
|
protected |
Definition at line 57 of file SubCommand.cpp.
References addSubCommandApp(), commandlineOpt, commandlineTriggerApp, final, helpOpt, helpTriggerApp, name, parent, selfAnchoredSubCommandApp, setConfigurable(), showConfigOpt, showConfigTriggerApp, and subCommandApp.
Referenced by net::config::ConfigInstance::ConfigInstance(), and utils::ConfigRoot::ConfigRoot().
|
inlineprotected |
Definition at line 271 of file SubCommand.h.
Referenced by web::http::client::ConfigHTTP::ConfigHTTP(), and subcommand::ConfigWWW::ConfigWWW().
|
delete |
|
delete |
|
virtual |
Definition at line 126 of file SubCommand.cpp.
| CLI::Option * utils::SubCommand::addFlag | ( | const std::string & | name, |
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| const CLI::Validator & | validator ) const |
Definition at line 395 of file SubCommand.cpp.
References initialize(), and subCommandApp.
Referenced by addFlag(), and utils::ConfigRoot::addRootOptions().
| CLI::Option * utils::SubCommand::addFlag | ( | const std::string & | name, |
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| ValueTypeT | defaultValue, | ||
| const CLI::Validator & | validator ) const |
Definition at line 358 of file SubCommand.h.
References addFlag().
Referenced by utils::ConfigRoot::addRootOptions(), web::http::client::ConfigHTTP::ConfigHTTP(), net::config::ConfigPhysicalSocket::ConfigPhysicalSocket(), net::config::ConfigTls::ConfigTls(), and net::config::ConfigTlsServer::ConfigTlsServer().
| CLI::Option * utils::SubCommand::addFlagFunction | ( | const std::string & | name, |
| const std::function< void()> & | callback, | ||
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| const CLI::Validator & | validator ) const |
Definition at line 406 of file SubCommand.cpp.
References subCommandApp.
Referenced by addFlagFunction().
| CLI::Option * utils::SubCommand::addFlagFunction | ( | const std::string & | name, |
| const std::function< void()> & | callback, | ||
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| const std::string & | defaultValue, | ||
| const CLI::Validator & | validator ) const |
Definition at line 428 of file SubCommand.cpp.
References addFlagFunction(), and setDefaultValue().
Referenced by utils::ConfigRoot::addRootOptions(), net::config::ConfigPhysicalSocket::addSocketOption(), net::config::ConfigInstance::ConfigInstance(), and net::config::ConfigPhysicalSocketClient::ConfigPhysicalSocketClient().
| CLI::Option * utils::SubCommand::addOption | ( | const std::string & | name, |
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| const CLI::Validator & | validator ) const |
Definition at line 372 of file SubCommand.cpp.
References initialize(), and subCommandApp.
Referenced by addOption(), utils::ConfigRoot::addRootOptions(), web::http::client::ConfigHTTP::ConfigHTTP(), net::config::ConfigTls::ConfigTls(), net::config::ConfigTlsClient::ConfigTlsClient(), and subcommand::ConfigWWW::ConfigWWW().
| CLI::Option * utils::SubCommand::addOption | ( | const std::string & | name, |
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| ValueTypeT | defaultValue, | ||
| const CLI::Validator & | validator ) const |
Definition at line 319 of file SubCommand.h.
References addOption().
Referenced by utils::ConfigRoot::addRootOptions(), net::config::ConfigPhysicalSocket::ConfigPhysicalSocket(), net::config::ConfigTls::ConfigTls(), and setLogFile().
| CLI::Option * utils::SubCommand::addOptionFunction | ( | const std::string & | name, |
| const std::function< void(const std::string &)> & | callback, | ||
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| const CLI::Validator & | validator ) const |
Definition at line 383 of file SubCommand.cpp.
References initialize(), and subCommandApp.
Referenced by addOptionFunction().
| CLI::Option * utils::SubCommand::addOptionFunction | ( | const std::string & | name, |
| const std::function< void(const std::string &)> & | callback, | ||
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| ValueTypeT | defaultValue, | ||
| const CLI::Validator & | validator ) const |
Definition at line 348 of file SubCommand.h.
References addOptionFunction().
| CLI::Option * utils::SubCommand::addOptionVariable | ( | const std::string & | name, |
| ValueTypeT & | variable, | ||
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| const CLI::Validator & | additionalValidator ) const |
Definition at line 328 of file SubCommand.h.
References initialize(), and subCommandApp.
Referenced by net::config::ConfigTlsServer::ConfigTlsServer().
| CLI::Option * utils::SubCommand::addOptionVariable | ( | const std::string & | name, |
| ValueTypeT & | variable, | ||
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| ValueTypeT | defaultValue, | ||
| const CLI::Validator & | additionalValidator ) const |
Definition at line 338 of file SubCommand.h.
| void utils::SubCommand::addSubCommandApp | ( | std::shared_ptr< utils::AppWithPtr > | subCommand | ) |
Definition at line 335 of file SubCommand.cpp.
References helpOpt, and subCommandApp.
Referenced by SubCommand().
| SubCommand * utils::SubCommand::allowExtras | ( | bool | allow = true | ) |
Definition at line 198 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::parse1().
| std::string utils::SubCommand::configToStr | ( | ) | const |
Definition at line 327 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::doWriteConfig().
|
protected |
Definition at line 141 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions(), and net::config::ConfigSection::ConfigSection().
| SubCommand * utils::SubCommand::disabled | ( | SubCommand * | subCommand, |
| bool | disabled = true ) |
Definition at line 291 of file SubCommand.cpp.
References needs(), and subCommandApp.
Referenced by net::config::ConfigInstance::ConfigInstance(), and net::config::ConfigInstance::setDisabled().
| SubCommand * utils::SubCommand::finalCallback | ( | const std::function< void()> & | finalCallback | ) |
Definition at line 321 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::bootstrap(), and net::config::ConfigTlsServer::ConfigTlsServer().
|
protected |
Definition at line 147 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
|
staticprotected |
Definition at line 204 of file SubCommand.cpp.
References commandlineTriggerApp.
Referenced by net::config::ConfigInstance::getCommandlineTriggerApp().
|
staticprotected |
Definition at line 212 of file SubCommand.cpp.
References helpTriggerApp.
Referenced by net::config::ConfigInstance::getHelpTriggerApp().
| std::string utils::SubCommand::getName | ( | ) | const |
Definition at line 129 of file SubCommand.cpp.
References name.
Referenced by net::config::ConfigTlsServer::ConfigTlsServer().
| CLI::Option * utils::SubCommand::getOption | ( | const std::string & | name | ) | const |
Definition at line 368 of file SubCommand.cpp.
References subCommandApp.
Referenced by net::config::ConfigPhysicalSocket::addSocketOption(), utils::doWriteConfig(), utils::getHelp(), and utils::ConfigRoot::parse2().
| SubCommand * utils::SubCommand::getParent | ( | ) | const |
Definition at line 188 of file SubCommand.cpp.
References parent.
Referenced by net::config::ConfigInstance::ConfigInstance(), net::config::ConfigTlsServer::ConfigTlsServer(), required(), and net::config::ConfigInstance::setDisabled().
|
inline |
Definition at line 138 of file SubCommand.h.
References subCommandApp.
|
staticprotected |
Definition at line 208 of file SubCommand.cpp.
References showConfigTriggerApp.
Referenced by net::config::ConfigInstance::getShowConfigTriggerApp().
| RequestedSubCommand * utils::SubCommand::getSubCommand | ( | ) |
Definition at line 301 of file SubCommand.h.
References utils::AppWithPtr::getPtr(), and subCommandApp.
Referenced by web::http::client::SocketContextFactory::create(), and main().
| RequestedSubCommand * utils::SubCommand::getSubCommand | ( | ) | const |
Definition at line 310 of file SubCommand.h.
References utils::AppWithPtr::getPtr(), and subCommandApp.
| bool utils::SubCommand::hasParent | ( | ) | const |
Definition at line 184 of file SubCommand.cpp.
References subCommandApp.
| std::string utils::SubCommand::help | ( | const CLI::App * | helpApp, |
| const CLI::AppFormatMode & | mode ) const |
Definition at line 331 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::getHelp().
|
private |
Definition at line 444 of file SubCommand.cpp.
References setConfigurable().
Referenced by addFlag(), addOption(), addOptionFunction(), and addOptionVariable().
| SubCommand * utils::SubCommand::needs | ( | SubCommand * | subCommand, |
| bool | needs = true ) |
Definition at line 281 of file SubCommand.cpp.
References subCommandApp.
Referenced by disabled(), required(), and required().
| NewSubCommand * utils::SubCommand::newSubCommand | ( | Args &&... | args | ) |
Definition at line 280 of file SubCommand.h.
References final.
Referenced by main().
|
delete |
|
delete |
|
protected |
Definition at line 137 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::Config::parse(), and utils::ConfigRoot::parse2().
|
protected |
Definition at line 153 of file SubCommand.cpp.
References childSubCommands, parent, and subCommandApp.
Referenced by utils::ConfigRoot::terminate(), and net::config::ConfigInstance::~ConfigInstance().
| SubCommand * utils::SubCommand::required | ( | bool | required = true, |
| bool | force = true ) |
Definition at line 216 of file SubCommand.cpp.
References getParent(), needs(), required(), requiredCount, and subCommandApp.
Referenced by required(), and required().
| SubCommand * utils::SubCommand::required | ( | CLI::Option * | option, |
| bool | required = true ) |
Definition at line 264 of file SubCommand.cpp.
References required(), and subCommandApp.
Referenced by subcommand::ConfigWWW::ConfigWWW(), and subcommand::ConfigWWW::setHtmlRoot().
| SubCommand * utils::SubCommand::required | ( | SubCommand * | subCommand, |
| bool | required = true ) |
Definition at line 235 of file SubCommand.cpp.
References needs(), required(), and subCommandApp.
Referenced by required().
| CLI::Option * utils::SubCommand::setConfig | ( | const std::string & | defaultConfigFile | ) | const |
Definition at line 164 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
|
protected |
Definition at line 437 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions(), ConfigDb::ConfigDb(), net::config::ConfigInstance::ConfigInstance(), net::config::ConfigInstance::configurable(), initialize(), and SubCommand().
|
protected |
Definition at line 367 of file SubCommand.h.
Referenced by addFlagFunction(), net::in6::stream::config::ConfigSocketClient::ConfigSocketClient(), net::in::stream::config::ConfigSocketClient::ConfigSocketClient(), net::in6::stream::config::ConfigSocketServer::ConfigSocketServer(), net::in::stream::config::ConfigSocketServer::ConfigSocketServer(), net::config::ConfigPhysicalSocketServer::setAcceptsPerTick(), net::config::ConfigPhysicalSocketServer::setAcceptTimeout(), net::config::ConfigPhysicalSocketServer::setBacklog(), net::config::ConfigTls::setCaCert(), net::config::ConfigTls::setCaCertAcceptUnknown(), net::config::ConfigTls::setCaCertDir(), net::config::ConfigTls::setCaCertUseDefaultDir(), net::config::ConfigTls::setCert(), net::config::ConfigTls::setCertKey(), net::config::ConfigTls::setCertKeyPassword(), net::config::ConfigTls::setCipherList(), net::config::ConfigPhysicalSocketClient::setConnectTimeout(), net::config::ConfigInstance::setDisabled(), net::in6::stream::config::ConfigSocketClient::setDisableNagleAlgorithm(), net::in6::stream::config::ConfigSocketServer::setDisableNagleAlgorithm(), net::in::stream::config::ConfigSocketClient::setDisableNagleAlgorithm(), net::in::stream::config::ConfigSocketServer::setDisableNagleAlgorithm(), net::config::ConfigTlsServer::setForceSni(), web::http::client::ConfigHTTP::setHostHeader(), subcommand::ConfigWWW::setHtmlRoot(), net::config::ConfigTls::setInitTimeout(), net::in6::stream::config::ConfigSocketServer::setIPv6Only(), web::http::client::ConfigHTTP::setPipelinedRequests(), net::config::ConfigConnection::setReadBlockSize(), net::config::ConfigConnection::setReadTimeout(), net::config::ConfigPhysicalSocketClient::setReconnect(), net::config::ConfigPhysicalSocketClient::setReconnectTime(), net::config::ConfigPhysicalSocket::setRetry(), net::config::ConfigPhysicalSocket::setRetryBase(), net::config::ConfigPhysicalSocket::setRetryJitter(), net::config::ConfigPhysicalSocket::setRetryLimit(), net::config::ConfigPhysicalSocket::setRetryOnFatal(), net::config::ConfigPhysicalSocket::setRetryTimeout(), net::config::ConfigPhysicalSocket::setRetryTries(), net::in6::stream::config::ConfigSocketServer::setReuseAddress(), net::in::stream::config::ConfigSocketServer::setReuseAddress(), net::in6::stream::config::ConfigSocketServer::setReusePort(), net::in::stream::config::ConfigSocketServer::setReusePort(), net::config::ConfigTls::setShutdownTimeout(), net::config::ConfigTlsClient::setSni(), net::config::ConfigTls::setSslOptions(), net::config::ConfigConnection::setTerminateTimeout(), net::config::ConfigConnection::setWriteBlockSize(), and net::config::ConfigConnection::setWriteTimeout().
| CLI::Option * utils::SubCommand::setLogFile | ( | const std::string & | defaultLogFile | ) | const |
Definition at line 176 of file SubCommand.cpp.
References addOption().
Referenced by utils::ConfigRoot::addRootOptions().
| SubCommand * utils::SubCommand::setRequireCallback | ( | const std::function< void(void)> & | callback | ) |
Definition at line 192 of file SubCommand.cpp.
References subCommandApp.
| CLI::Option * utils::SubCommand::setVersionFlag | ( | const std::string & | version | ) | const |
Definition at line 180 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
| std::string utils::SubCommand::version | ( | ) | const |
Definition at line 133 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::parse2().
|
staticprotected |
Definition at line 242 of file SubCommand.h.
Referenced by utils::ConfigRoot::parse2().
|
private |
Definition at line 256 of file SubCommand.h.
Referenced by removeSubCommand().
|
private |
Definition at line 265 of file SubCommand.h.
Referenced by SubCommand().
|
staticprotected |
Definition at line 246 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getCommandlineTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 258 of file SubCommand.h.
Referenced by newSubCommand(), and SubCommand().
|
protected |
Definition at line 261 of file SubCommand.h.
Referenced by addSubCommandApp(), utils::ConfigRoot::parse1(), and SubCommand().
|
staticprotected |
Definition at line 244 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getHelpTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 252 of file SubCommand.h.
Referenced by getName(), and SubCommand().
|
private |
Definition at line 253 of file SubCommand.h.
Referenced by getParent(), removeSubCommand(), and SubCommand().
|
private |
Definition at line 267 of file SubCommand.h.
Referenced by required().
|
staticprotected |
Definition at line 240 of file SubCommand.h.
|
private |
Definition at line 255 of file SubCommand.h.
Referenced by SubCommand().
|
private |
Definition at line 264 of file SubCommand.h.
Referenced by SubCommand().
|
staticprotected |
Definition at line 245 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getShowConfigTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 251 of file SubCommand.h.
Referenced by addFlag(), addFlagFunction(), addOption(), addOptionFunction(), addOptionVariable(), addSubCommandApp(), allowExtras(), configToStr(), description(), disabled(), finalCallback(), footer(), getOption(), getRequired(), getSubCommand(), getSubCommand(), hasParent(), help(), needs(), parse(), removeSubCommand(), required(), required(), required(), setConfig(), setConfigurable(), setRequireCallback(), setVersionFlag(), SubCommand(), and version().