|
| config_decorator (main_app *a_main, app *a_this_app) |
|
| config_decorator (const config_decorator &)=delete |
|
| config_decorator (config_decorator &&)=delete |
|
virtual | ~config_decorator () |
|
config_decorator & | operator= (const config_decorator &)=delete |
|
config_decorator & | operator= (config_decorator &&)=delete |
|
main_app * | main () const |
|
app * | this_app () const |
|
config_decorator * | add_config_subcommand (std::string a_subcommand_name, std::string a_description="") |
| Add a subcommand that is linked to a particular main_app and can create options that modify that main_app's master config. More...
|
|
template<typename T , CLI::enable_if_t< ! CLI::is_vector< T >::value, CLI::detail::enabler > = CLI::detail::dummy> |
CLI::Option * | add_config_option (std::string a_name, std::string a_master_config_addr, std::string a_description="") |
| Add an option that gets automatically added to the master config of a main_app. More...
|
|
template<typename T , CLI::enable_if_t< ! CLI::is_vector< T >::value, CLI::detail::enabler > = CLI::detail::dummy> |
CLI::Option * | add_config_multi_option (std::string a_name, std::string a_master_config_addr, std::string a_description="") |
| Add an option that gets automatically added to the master config of a main_app. More...
|
|
template<typename T , CLI::enable_if_t< std::is_integral< T >::value &&! CLI::is_bool< T >::value, CLI::detail::enabler > = CLI::detail::dummy> |
CLI::Option * | add_config_flag (std::string a_name, std::string a_master_config_addr, std::string a_description="") |
|
template<typename T , CLI::enable_if_t< CLI::is_bool< T >::value, CLI::detail::enabler > = CLI::detail::dummy> |
CLI::Option * | add_config_flag (std::string a_name, std::string a_master_config_addr, std::string a_description="") |
|
Adds the ability to create options and subcommands that are tied to a main_app's master config.
- Author
- N. S. Oblath
Note that while this class is called a decorator, it does not follow the actual decorator pattern. It does, however, follow the spirit of that pattern in that it adds a capability to the CLI::App class.
Subcommands and options are tied to the main_app in slightly different ways because of the different ways in which those two CLI11 classes are used.
Subcommands are CLI::App objects, and any App can have subcommands. Therefore the collection of Apps in use in a given application can form a multi-level parent-child structure. Each parent App can have multiple children, and owns those child App objects. The children can also be parents, of course. The scarab::config_decorator for each subcommand App object is created by the parent config_decorator's add_config_subcommand() function. That decorator has a link to its App and is owned by its parent decorator.
At the top of the App hierarchy is the primary App. In Scarab, that's the main_app, which also inherits from config_decorator. So main_app is also the top of the config_decorator hierarchy.
Options, on the other hand, do not form their own hierarchy. Each App owns its options. On the Scarab side, though, even options that belong to subcommands contribute to the main_app's master config. Therefore when config_decorator::add_config_option() is used, the app_option_holder that corresponds to the new option is given directly to the main_app.
Definition at line 55 of file application.hh.