#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 |
| std::string | configToStr () const |
| std::string | help (const CLI::App *helpApp, const CLI::AppFormatMode &mode) const |
| bool | hasParent () const |
| SubCommand * | getParent () const |
| SubCommand * | allowExtras (bool allow=true) |
| SubCommand * | forceUnrequired (bool unrequired=true) |
| SubCommand * | required (bool required=true) |
| SubCommand * | required (CLI::Option *option, bool required=true) |
| bool | getRequired () const |
| SubCommand * | needs (SubCommand *subCommand, bool needs=true) |
| SubCommand * | setRequireCallback (const std::function< void(void)> &callback) |
| SubCommand * | finalCallback (const std::function< void()> &finalCallback) |
| 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 * | 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 |
| CLI::Option * | getOption (const std::string &name) const |
| 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 |
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 () |
| CLI::Option * | addConfigFlag (const std::string &defaultConfigFile) const |
| CLI::Option * | addLogFileFlag (const std::string &defaultLogFile) const |
| CLI::Option * | addVersionFlag (const std::string &version) const |
Static Protected Member Functions | |
| static CLI::App * | getHelpTriggerApp () |
| static CLI::App * | getShowConfigTriggerApp () |
| static CLI::App * | getCommandlineTriggerApp () |
Protected Attributes | |
| CLI::Option * | helpOpt = nullptr |
| CLI::Option * | showConfigOpt = nullptr |
| CLI::Option * | commandlineOpt = nullptr |
Static Protected Attributes | |
| 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 |
| int | requiredCount = 0 |
| bool | requiredForced = false |
| bool | final |
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 128 of file SubCommand.cpp.
References removeSubCommand().
|
protected |
Definition at line 296 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
| 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 339 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 351 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 350 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 372 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().
|
protected |
Definition at line 308 of file SubCommand.cpp.
References addOption().
Referenced by utils::ConfigRoot::addRootOptions().
| 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 316 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 312 of file SubCommand.h.
References addOption().
Referenced by addLogFileFlag(), utils::ConfigRoot::addRootOptions(), net::config::ConfigPhysicalSocket::ConfigPhysicalSocket(), and net::config::ConfigTls::ConfigTls().
| 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 327 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 341 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 321 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 331 of file SubCommand.h.
| void utils::SubCommand::addSubCommandApp | ( | std::shared_ptr< utils::AppWithPtr > | subCommand | ) |
Definition at line 282 of file SubCommand.cpp.
References helpOpt, and subCommandApp.
Referenced by SubCommand().
|
protected |
Definition at line 312 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
| SubCommand * utils::SubCommand::allowExtras | ( | bool | allow = true | ) |
Definition at line 191 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::parse1().
| std::string utils::SubCommand::configToStr | ( | ) | const |
Definition at line 175 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::doWriteConfig().
|
protected |
Definition at line 144 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions(), and net::config::ConfigSection::ConfigSection().
| SubCommand * utils::SubCommand::finalCallback | ( | const std::function< void()> & | finalCallback | ) |
Definition at line 276 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::bootstrap(), and net::config::ConfigTlsServer::ConfigTlsServer().
|
protected |
Definition at line 150 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
| SubCommand * utils::SubCommand::forceUnrequired | ( | bool | unrequired = true | ) |
Definition at line 197 of file SubCommand.cpp.
References getParent(), hasParent(), needs(), required(), requiredForced, and subCommandApp.
Referenced by net::config::ConfigInstance::ConfigInstance(), and net::config::ConfigInstance::setDisabled().
|
staticprotected |
Definition at line 399 of file SubCommand.cpp.
References commandlineTriggerApp.
Referenced by net::config::ConfigInstance::getCommandlineTriggerApp().
|
staticprotected |
Definition at line 391 of file SubCommand.cpp.
References helpTriggerApp.
Referenced by net::config::ConfigInstance::getHelpTriggerApp().
| std::string utils::SubCommand::getName | ( | ) | const |
Definition at line 132 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 381 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 187 of file SubCommand.cpp.
References parent.
Referenced by net::config::ConfigTlsServer::ConfigTlsServer(), forceUnrequired(), and required().
| bool utils::SubCommand::getRequired | ( | ) | const |
Definition at line 256 of file SubCommand.cpp.
References subCommandApp.
|
staticprotected |
Definition at line 395 of file SubCommand.cpp.
References showConfigTriggerApp.
Referenced by net::config::ConfigInstance::getShowConfigTriggerApp().
| RequestedSubCommand * utils::SubCommand::getSubCommand | ( | ) |
Definition at line 286 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 299 of file SubCommand.h.
References utils::AppWithPtr::getPtr(), and subCommandApp.
| bool utils::SubCommand::hasParent | ( | ) | const |
Definition at line 183 of file SubCommand.cpp.
References subCommandApp.
Referenced by forceUnrequired(), and required().
| std::string utils::SubCommand::help | ( | const CLI::App * | helpApp, |
| const CLI::AppFormatMode & | mode ) const |
Definition at line 179 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::getHelp().
|
private |
Definition at line 404 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 260 of file SubCommand.cpp.
References subCommandApp.
Referenced by forceUnrequired(), and required().
| NewSubCommand * utils::SubCommand::newSubCommand | ( | Args &&... | args | ) |
Definition at line 280 of file SubCommand.h.
Referenced by main().
|
delete |
|
delete |
|
protected |
Definition at line 140 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::Config::parse(), and utils::ConfigRoot::parse2().
|
protected |
Definition at line 156 of file SubCommand.cpp.
References childSubCommands, parent, and subCommandApp.
Referenced by utils::ConfigRoot::terminate(), net::config::ConfigInstance::~ConfigInstance(), and ~SubCommand().
| SubCommand * utils::SubCommand::required | ( | bool | required = true | ) |
Definition at line 217 of file SubCommand.cpp.
References getParent(), hasParent(), needs(), required(), requiredCount, requiredForced, and subCommandApp.
Referenced by forceUnrequired(), required(), and required().
| SubCommand * utils::SubCommand::required | ( | CLI::Option * | option, |
| bool | required = true ) |
Definition at line 239 of file SubCommand.cpp.
References required(), and subCommandApp.
Referenced by subcommand::ConfigWWW::ConfigWWW(), and subcommand::ConfigWWW::setHtmlRoot().
| CLI::Option * utils::SubCommand::setConfigurable | ( | CLI::Option * | option, |
| bool | configurable ) const |
Definition at line 385 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions(), ConfigDb::ConfigDb(), net::config::ConfigInstance::ConfigInstance(), net::config::ConfigInstance::configurable(), initialize(), and SubCommand().
| CLI::Option * utils::SubCommand::setDefaultValue | ( | CLI::Option * | option, |
| const ValueTypeT & | value, | ||
| bool | clear = true ) const |
Definition at line 360 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::setCaCertDirUseDefault(), 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().
| SubCommand * utils::SubCommand::setRequireCallback | ( | const std::function< void(void)> & | callback | ) |
Definition at line 270 of file SubCommand.cpp.
References subCommandApp.
| std::string utils::SubCommand::version | ( | ) | const |
Definition at line 136 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::parse2().
|
staticprotected |
Definition at line 239 of file SubCommand.h.
Referenced by utils::ConfigRoot::parse2().
|
private |
Definition at line 262 of file SubCommand.h.
Referenced by removeSubCommand().
|
protected |
Definition at line 255 of file SubCommand.h.
Referenced by SubCommand().
|
staticprotected |
Definition at line 243 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getCommandlineTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 267 of file SubCommand.h.
Referenced by SubCommand().
|
protected |
Definition at line 253 of file SubCommand.h.
Referenced by addSubCommandApp(), utils::ConfigRoot::parse1(), and SubCommand().
|
staticprotected |
Definition at line 241 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getHelpTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 249 of file SubCommand.h.
Referenced by getName(), and SubCommand().
|
private |
Definition at line 250 of file SubCommand.h.
Referenced by getParent(), removeSubCommand(), and SubCommand().
|
private |
Definition at line 264 of file SubCommand.h.
Referenced by required().
|
private |
Definition at line 265 of file SubCommand.h.
Referenced by forceUnrequired(), and required().
|
private |
Definition at line 258 of file SubCommand.h.
Referenced by SubCommand().
|
protected |
Definition at line 254 of file SubCommand.h.
Referenced by SubCommand().
|
staticprotected |
Definition at line 242 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getShowConfigTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 248 of file SubCommand.h.
Referenced by addConfigFlag(), addFlag(), addFlagFunction(), addOption(), addOptionFunction(), addOptionVariable(), addSubCommandApp(), addVersionFlag(), allowExtras(), configToStr(), description(), finalCallback(), footer(), forceUnrequired(), getOption(), getRequired(), getSubCommand(), getSubCommand(), hasParent(), help(), needs(), parse(), removeSubCommand(), required(), required(), setConfigurable(), setRequireCallback(), SubCommand(), and version().