#include <Config.h>
Public Member Functions | |
| ~ConfigRoot () override | |
| ConfigRoot * | addRootOptions (const std::string &applicationName, const std::string &userName, const std::string &groupName, const std::string &configDirectory, const std::string &logDirectory, const std::string &pidDirectory) |
| bool | parse1 (int argc, char *argv[]) |
| bool | bootstrap (int argc, char *argv[]) |
| void | terminate () |
| Public Member Functions inherited from utils::SubCommand | |
| 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) |
Protected Member Functions | |
| bool | parse2 (int argc, char *argv[], bool parse1=false) |
| Protected Member Functions inherited from utils::SubCommand | |
| 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 |
Private Member Functions | |
| ConfigRoot () | |
Private Attributes | |
| std::string | applicationName |
| std::string | pidDirectory |
| CLI::Option * | daemonizeOpt = nullptr |
| CLI::Option * | logFileOpt = nullptr |
| CLI::Option * | monochromLogOpt = nullptr |
| CLI::Option * | userNameOpt = nullptr |
| CLI::Option * | groupNameOpt = nullptr |
| CLI::Option * | enforceLogFileOpt = nullptr |
| CLI::Option * | logLevelOpt = nullptr |
| CLI::Option * | verboseLevelOpt = nullptr |
| CLI::Option * | quietOpt = nullptr |
| CLI::Option * | versionOpt = nullptr |
| CLI::Option * | writeConfigOpt = nullptr |
| CLI::Option * | killOpt = nullptr |
| CLI::Option * | aliasOpt = nullptr |
Friends | |
| class | Config |
Additional Inherited Members | |
| Static Public Member Functions inherited from utils::SubCommand | |
| static CLI::App * | getHelpTriggerApp () |
| static CLI::App * | getShowConfigTriggerApp () |
| static CLI::App * | getCommandlineTriggerApp () |
| Static Public Attributes inherited from utils::SubCommand | |
| static std::shared_ptr< CLI::Formatter > | sectionFormatter = makeSectionFormatter() |
| Static Protected Attributes inherited from utils::SubCommand | |
| static std::map< std::string, std::string > | aliases |
| static CLI::App * | helpTriggerApp = nullptr |
| static CLI::App * | showConfigTriggerApp = nullptr |
| static CLI::App * | commandlineTriggerApp = nullptr |
|
private |
Definition at line 357 of file Config.cpp.
References utils::Config::configRootApp, logger::Logger::init(), and utils::SubCommand::SubCommand().
|
override |
Definition at line 363 of file Config.cpp.
| ConfigRoot * utils::ConfigRoot::addRootOptions | ( | const std::string & | applicationName, |
| const std::string & | userName, | ||
| const std::string & | groupName, | ||
| const std::string & | configDirectory, | ||
| const std::string & | logDirectory, | ||
| const std::string & | pidDirectory ) |
Definition at line 366 of file Config.cpp.
References utils::SubCommand::addFlag(), utils::SubCommand::addFlag(), utils::SubCommand::addFlagFunction(), utils::SubCommand::addOption(), utils::SubCommand::addOption(), aliasOpt, applicationName, daemonizeOpt, utils::SubCommand::description(), enforceLogFileOpt, utils::SubCommand::footer(), logger::Logger::getDisableColor(), groupNameOpt, killOpt, logFileOpt, logLevelOpt, monochromLogOpt, pidDirectory, quietOpt, utils::SubCommand::setConfig(), utils::SubCommand::setConfigurable(), logger::Logger::setDisableColor(), utils::SubCommand::setLogFile(), utils::SubCommand::setVersionFlag(), userNameOpt, verboseLevelOpt, versionOpt, and writeConfigOpt.
Referenced by utils::Config::init().
| bool utils::ConfigRoot::bootstrap | ( | int | argc, |
| char * | argv[] ) |
Definition at line 500 of file Config.cpp.
References applicationName, utils::SubCommand::commandlineTriggerApp, daemonizeOpt, enforceLogFileOpt, utils::SubCommand::finalCallback(), groupNameOpt, utils::SubCommand::helpTriggerApp, logFileOpt, logger::Logger::logToFile(), parse2(), pidDirectory, logger::Logger::setQuiet(), utils::SubCommand::showConfigTriggerApp, utils::Daemon::startDaemon(), userNameOpt, and writeConfigOpt.
Referenced by utils::Config::bootstrap().
| bool utils::ConfigRoot::parse1 | ( | int | argc, |
| char * | argv[] ) |
Definition at line 468 of file Config.cpp.
References utils::SubCommand::allowExtras(), utils::SubCommand::commandlineTriggerApp, utils::SubCommand::helpTriggerApp, killOpt, logLevelOpt, parse2(), pidDirectory, quietOpt, logger::Logger::setLogLevel(), logger::Logger::setQuiet(), logger::Logger::setVerboseLevel(), utils::SubCommand::showConfigTriggerApp, utils::Daemon::stopDaemon(), verboseLevelOpt, and versionOpt.
Referenced by utils::Config::init().
|
protected |
Definition at line 547 of file Config.cpp.
References utils::SubCommand::aliases, utils::SubCommand::commandlineTriggerApp, utils::doWriteConfig(), Color::FG_DEFAULT, Color::FG_RED, utils::getCommandLine(), utils::getConfig(), utils::getHelp(), utils::SubCommand::getOption(), utils::DaemonSignaled::getPid(), utils::SubCommand::helpTriggerApp, utils::SubCommand::parse(), logger::Logger::setQuiet(), utils::SubCommand::showConfigTriggerApp, utils::SubCommand::version(), and versionOpt.
Referenced by bootstrap(), and parse1().
| void utils::ConfigRoot::terminate | ( | ) |
Definition at line 528 of file Config.cpp.
References applicationName, daemonizeOpt, utils::Daemon::erasePidFile(), and pidDirectory.
Referenced by utils::Config::terminate().
|
private |
Definition at line 95 of file Config.h.
Referenced by addRootOptions().
|
private |
Definition at line 80 of file Config.h.
Referenced by addRootOptions(), bootstrap(), and terminate().
|
private |
Definition at line 83 of file Config.h.
Referenced by addRootOptions(), bootstrap(), and terminate().
|
private |
Definition at line 88 of file Config.h.
Referenced by addRootOptions(), and bootstrap().
|
private |
Definition at line 87 of file Config.h.
Referenced by addRootOptions(), and bootstrap().
|
private |
Definition at line 94 of file Config.h.
Referenced by addRootOptions(), and parse1().
|
private |
Definition at line 84 of file Config.h.
Referenced by addRootOptions(), and bootstrap().
|
private |
Definition at line 89 of file Config.h.
Referenced by addRootOptions(), utils::Config::getLogLevel(), and parse1().
|
private |
Definition at line 85 of file Config.h.
Referenced by addRootOptions().
|
private |
Definition at line 81 of file Config.h.
Referenced by addRootOptions(), bootstrap(), parse1(), and terminate().
|
private |
Definition at line 91 of file Config.h.
Referenced by addRootOptions(), and parse1().
|
private |
Definition at line 86 of file Config.h.
Referenced by addRootOptions(), and bootstrap().
|
private |
Definition at line 90 of file Config.h.
Referenced by addRootOptions(), utils::Config::getVerboseLevel(), and parse1().
|
private |
Definition at line 92 of file Config.h.
Referenced by addRootOptions(), parse1(), and parse2().
|
private |
Definition at line 93 of file Config.h.
Referenced by addRootOptions(), and bootstrap().