#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 |
| void | parse (int argc, char *argv[]) |
| 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 () |
| 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) |
| 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 |
| 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, 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, 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) |
| 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) |
Static Public Member Functions | |
| static CLI::App * | getHelpTriggerApp () |
| static CLI::App * | getShowConfigTriggerApp () |
| static CLI::App * | getCommandlineTriggerApp () |
Static Public Attributes | |
| static std::shared_ptr< CLI::Formatter > | sectionFormatter = makeSectionFormatter() |
Protected Member Functions | |
| SubCommand (SubCommand *parent, std::shared_ptr< utils::AppWithPtr > appWithPtr, const std::string &group, bool final) | |
| template<typename ConcretSubCommand> | |
| SubCommand (SubCommand *parent, ConcretSubCommand *concretSubCommand, const std::string &group, bool final=true) | |
| SubCommand * | description (const std::string &description) |
| SubCommand * | footer (const std::string &footer) |
| 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 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 |
| SubCommand * | parent |
| bool | final |
| CLI::Option * | helpOpt = nullptr |
| CLI::Option * | showConfigOpt = nullptr |
| CLI::Option * | commandlineOpt = nullptr |
| int | requiredCount = 0 |
Definition at line 96 of file SubCommand.h.
|
protected |
Definition at line 57 of file SubCommand.cpp.
References commandlineOpt, commandlineTriggerApp, final, helpOpt, helpTriggerApp, parent, setConfigurable(), showConfigOpt, showConfigTriggerApp, and subCommandApp.
Referenced by net::config::ConfigInstance::ConfigInstance(), and utils::ConfigRoot::ConfigRoot().
|
inlineprotected |
Definition at line 257 of file SubCommand.h.
Referenced by web::http::client::ConfigHTTP::ConfigHTTP(), and subcommand::ConfigWWW::ConfigWWW().
|
delete |
|
delete |
|
virtual |
Definition at line 152 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 396 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 328 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 ) |
Definition at line 407 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 ) |
Definition at line 429 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 373 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 289 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, |
| std::function< void(const std::string &)> & | callback, | ||
| const std::string & | description, | ||
| const std::string & | typeName, | ||
| const CLI::Validator & | validator ) const |
Definition at line 384 of file SubCommand.cpp.
References initialize(), and subCommandApp.
Referenced by addOptionFunction().
| CLI::Option * utils::SubCommand::addOptionFunction | ( | const std::string & | name, |
| 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 318 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 298 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 308 of file SubCommand.h.
| SubCommand * utils::SubCommand::allowExtras | ( | bool | allow = true | ) |
Definition at line 213 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::parse1().
| std::string utils::SubCommand::configToStr | ( | ) | const |
Definition at line 342 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::doWriteConfig().
|
protected |
Definition at line 167 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 306 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 336 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::bootstrap(), and net::config::ConfigTlsServer::ConfigTlsServer().
|
protected |
Definition at line 173 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
|
static |
Definition at line 219 of file SubCommand.cpp.
References commandlineTriggerApp.
|
static |
Definition at line 227 of file SubCommand.cpp.
References helpTriggerApp.
| std::string utils::SubCommand::getName | ( | ) | const |
Definition at line 155 of file SubCommand.cpp.
References subCommandApp.
Referenced by net::config::ConfigTlsServer::ConfigTlsServer().
| CLI::Option * utils::SubCommand::getOption | ( | const std::string & | name | ) | const |
Definition at line 369 of file SubCommand.cpp.
References subCommandApp.
Referenced by net::config::ConfigPhysicalSocket::addSocketOption(), utils::doWriteConfig(), utils::getHelp(), and utils::ConfigRoot::parse2().
| SubCommand * utils::SubCommand::getParent | ( | ) |
Definition at line 203 of file SubCommand.cpp.
References parent.
Referenced by net::config::ConfigTlsServer::ConfigTlsServer(), and required().
|
static |
Definition at line 223 of file SubCommand.cpp.
References showConfigTriggerApp.
| RequestedSubCommand * utils::SubCommand::getSubCommand | ( | ) |
Definition at line 271 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 280 of file SubCommand.h.
References utils::AppWithPtr::getPtr(), and subCommandApp.
| bool utils::SubCommand::hasParent | ( | ) | const |
Definition at line 199 of file SubCommand.cpp.
References subCommandApp.
| std::string utils::SubCommand::help | ( | const CLI::App * | helpApp, |
| const CLI::AppFormatMode & | mode ) const |
Definition at line 346 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::getHelp().
|
private |
Definition at line 445 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 296 of file SubCommand.cpp.
References subCommandApp.
Referenced by disabled(), required(), and required().
| NewSubCommand * utils::SubCommand::newSubCommand | ( | Args &&... | args | ) |
Definition at line 266 of file SubCommand.h.
References final.
Referenced by main().
|
delete |
|
delete |
| void utils::SubCommand::parse | ( | int | argc, |
| char * | argv[] ) |
Definition at line 163 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::Config::parse(), and utils::ConfigRoot::parse2().
| SubCommand * utils::SubCommand::required | ( | bool | required = true, |
| bool | force = true ) |
Definition at line 231 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 279 of file SubCommand.cpp.
References required(), and subCommandApp.
Referenced by ConfigDb::ConfigDb(), subcommand::ConfigWWW::ConfigWWW(), ConfigDb::setHost(), and subcommand::ConfigWWW::setHtmlRoot().
| SubCommand * utils::SubCommand::required | ( | SubCommand * | subCommand, |
| bool | required = true ) |
Definition at line 250 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 179 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
|
protected |
Definition at line 438 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 337 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 191 of file SubCommand.cpp.
References addOption().
Referenced by utils::ConfigRoot::addRootOptions().
| SubCommand * utils::SubCommand::setRequireCallback | ( | const std::function< void(void)> & | callback | ) |
Definition at line 207 of file SubCommand.cpp.
References subCommandApp.
| CLI::Option * utils::SubCommand::setVersionFlag | ( | const std::string & | version | ) | const |
Definition at line 195 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::addRootOptions().
| std::string utils::SubCommand::version | ( | ) | const |
Definition at line 159 of file SubCommand.cpp.
References subCommandApp.
Referenced by utils::ConfigRoot::parse2().
|
staticprotected |
Definition at line 235 of file SubCommand.h.
Referenced by utils::ConfigRoot::parse2().
|
private |
Definition at line 251 of file SubCommand.h.
Referenced by SubCommand().
|
staticprotected |
Definition at line 239 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getCommandlineTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 247 of file SubCommand.h.
Referenced by newSubCommand(), and SubCommand().
|
private |
Definition at line 249 of file SubCommand.h.
Referenced by SubCommand().
|
staticprotected |
Definition at line 237 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getHelpTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 245 of file SubCommand.h.
Referenced by getParent(), and SubCommand().
|
private |
Definition at line 253 of file SubCommand.h.
Referenced by required().
|
static |
Definition at line 232 of file SubCommand.h.
|
private |
Definition at line 250 of file SubCommand.h.
Referenced by SubCommand().
|
staticprotected |
Definition at line 238 of file SubCommand.h.
Referenced by utils::ConfigRoot::bootstrap(), getShowConfigTriggerApp(), utils::ConfigRoot::parse1(), utils::ConfigRoot::parse2(), and SubCommand().
|
private |
Definition at line 244 of file SubCommand.h.
Referenced by addFlag(), addFlagFunction(), addOption(), addOptionFunction(), addOptionVariable(), allowExtras(), configToStr(), description(), disabled(), finalCallback(), footer(), getName(), getOption(), getSubCommand(), getSubCommand(), hasParent(), help(), needs(), parse(), required(), required(), required(), setConfig(), setConfigurable(), setRequireCallback(), setVersionFlag(), SubCommand(), and version().