Wire Sysio Wire Sysion 1.0.0
|
Creates a command line program, with very few defaults. More...
#include <CLI11.hpp>
Public Member Functions | |
void | _move_option (Option *opt, App *app) |
function that could be used by subclasses of App to shift options around into subcommands | |
Basic | |
App (std::string app_description="", std::string app_name="") | |
Create a new program. Pass in the same arguments as main(), along with a help string. | |
App (const App &)=delete | |
App & | operator= (const App &)=delete |
virtual | ~App ()=default |
virtual destructor | |
App * | callback (std::function< void()> app_callback) |
App * | final_callback (std::function< void()> app_callback) |
App * | parse_complete_callback (std::function< void()> pc_callback) |
App * | preparse_callback (std::function< void(std::size_t)> pp_callback) |
App * | name (std::string app_name="") |
Set a name for the app (empty will use parser to set the name) | |
App * | alias (std::string app_name) |
Set an alias for the app. | |
App * | allow_extras (bool allow=true) |
Remove the error when extras are left over on the command line. | |
App * | required (bool require=true) |
Remove the error when extras are left over on the command line. | |
App * | disabled (bool disable=true) |
Disable the subcommand or option group. | |
App * | disabled_by_default (bool disable=true) |
Set the subcommand to be disabled by default, so on clear(), at the start of each parse it is disabled. | |
App * | enabled_by_default (bool enable=true) |
App * | immediate_callback (bool immediate=true) |
Set the subcommand callback to be executed immediately on subcommand completion. | |
App * | validate_positionals (bool validate=true) |
Set the subcommand to validate positional arguments before assigning. | |
App * | allow_config_extras (bool allow=true) |
ignore extras in config files | |
App * | allow_config_extras (config_extras_mode mode) |
ignore extras in config files | |
App * | prefix_command (bool allow=true) |
Do not parse anything after the first unrecognized option and return. | |
App * | ignore_case (bool value=true) |
Ignore case. Subcommands inherit value. | |
App * | allow_windows_style_options (bool value=true) |
App * | positionals_at_end (bool value=true) |
Specify that the positional arguments are only at the end of the sequence. | |
App * | configurable (bool value=true) |
Specify that the subcommand can be triggered by a config file. | |
App * | ignore_underscore (bool value=true) |
Ignore underscore. Subcommands inherit value. | |
App * | formatter (std::shared_ptr< FormatterBase > fmt) |
Set the help formatter. | |
App * | formatter_fn (std::function< std::string(const App *, std::string, AppFormatMode)> fmt) |
Set the help formatter. | |
App * | config_formatter (std::shared_ptr< Config > fmt) |
Set the config formatter. | |
bool | parsed () const |
Check to see if this subcommand was parsed, true only if received on command line. | |
OptionDefaults * | option_defaults () |
Get the OptionDefault object, to set option defaults. | |
Subcommmands | |
App * | add_subcommand (std::string subcommand_name="", std::string subcommand_description="") |
Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag. | |
App * | add_subcommand (CLI::App_p subcom) |
Add a previously created app as a subcommand. | |
bool | remove_subcommand (App *subcom) |
Removes a subcommand from the App. Takes a subcommand pointer. Returns true if found and removed. | |
App * | get_subcommand (const App *subcom) const |
App * | get_subcommand (std::string subcom) const |
Check to see if a subcommand is part of this command (text version) | |
App * | get_subcommand (int index=0) const |
Get a pointer to subcommand by index. | |
CLI::App_p | get_subcommand_ptr (App *subcom) const |
Check to see if a subcommand is part of this command and get a shared_ptr to it. | |
CLI::App_p | get_subcommand_ptr (std::string subcom) const |
Check to see if a subcommand is part of this command (text version) | |
CLI::App_p | get_subcommand_ptr (int index=0) const |
Get an owning pointer to subcommand by index. | |
App * | get_option_group (std::string group_name) const |
Check to see if an option group is part of this App. | |
std::size_t | count () const |
std::size_t | count_all () const |
App * | group (std::string group_name) |
Changes the group membership. | |
App * | require_subcommand () |
The argumentless form of require subcommand requires 1 or more subcommands. | |
App * | require_subcommand (int value) |
App * | require_subcommand (std::size_t min, std::size_t max) |
App * | require_option () |
The argumentless form of require option requires 1 or more options be used. | |
App * | require_option (int value) |
App * | require_option (std::size_t min, std::size_t max) |
App * | fallthrough (bool value=true) |
operator bool () const | |
Extras for subclassing | |
virtual void | pre_callback () |
Post parsing | |
std::size_t | count (std::string option_name) const |
Counts the number of times the given option was passed. | |
std::vector< App * > | get_subcommands () const |
std::vector< const App * > | get_subcommands (const std::function< bool(const App *)> &filter) const |
std::vector< App * > | get_subcommands (const std::function< bool(App *)> &filter) |
bool | got_subcommand (const App *subcom) const |
Check to see if given subcommand was selected. | |
bool | got_subcommand (std::string subcommand_name) const |
Check with name instead of pointer to see if subcommand was selected. | |
App * | excludes (Option *opt) |
Sets excluded options for the subcommand. | |
App * | excludes (App *app) |
Sets excluded subcommands for the subcommand. | |
App * | needs (Option *opt) |
App * | needs (App *app) |
bool | remove_excludes (Option *opt) |
Removes an option from the excludes list of this subcommand. | |
bool | remove_excludes (App *app) |
Removes a subcommand from the excludes list of this subcommand. | |
bool | remove_needs (Option *opt) |
Removes an option from the needs list of this subcommand. | |
bool | remove_needs (App *app) |
Removes a subcommand from the needs list of this subcommand. | |
Getters | |
std::shared_ptr< FormatterBase > | get_formatter () const |
Access the formatter. | |
std::shared_ptr< Config > | get_config_formatter () const |
Access the config formatter. | |
std::shared_ptr< ConfigBase > | get_config_formatter_base () const |
Access the config formatter as a configBase pointer. | |
std::string | get_description () const |
Get the app or subcommand description. | |
App * | description (std::string app_description) |
Set the description of the app. | |
std::vector< const Option * > | get_options (const std::function< bool(const Option *)> filter={}) const |
Get the list of options (user facing function, so returns raw pointers), has optional filter function. | |
std::vector< Option * > | get_options (const std::function< bool(Option *)> filter={}) |
Non-const version of the above. | |
Option * | get_option_no_throw (std::string option_name) noexcept |
Get an option by name (noexcept non-const version) | |
const Option * | get_option_no_throw (std::string option_name) const noexcept |
Get an option by name (noexcept const version) | |
const Option * | get_option (std::string option_name) const |
Get an option by name. | |
Option * | get_option (std::string option_name) |
Get an option by name (non-const version) | |
const Option * | operator[] (const std::string &option_name) const |
Shortcut bracket operator for getting a pointer to an option. | |
const Option * | operator[] (const char *option_name) const |
Shortcut bracket operator for getting a pointer to an option. | |
bool | get_ignore_case () const |
Check the status of ignore_case. | |
bool | get_ignore_underscore () const |
Check the status of ignore_underscore. | |
bool | get_fallthrough () const |
Check the status of fallthrough. | |
bool | get_allow_windows_style_options () const |
Check the status of the allow windows style options. | |
bool | get_positionals_at_end () const |
Check the status of the allow windows style options. | |
bool | get_configurable () const |
Check the status of the allow windows style options. | |
const std::string & | get_group () const |
Get the group of this subcommand. | |
std::string | get_footer () const |
Generate and return the footer. | |
std::size_t | get_require_subcommand_min () const |
Get the required min subcommand value. | |
std::size_t | get_require_subcommand_max () const |
Get the required max subcommand value. | |
std::size_t | get_require_option_min () const |
Get the required min option value. | |
std::size_t | get_require_option_max () const |
Get the required max option value. | |
bool | get_prefix_command () const |
Get the prefix command status. | |
bool | get_allow_extras () const |
Get the status of allow extras. | |
bool | get_required () const |
Get the status of required. | |
bool | get_disabled () const |
Get the status of disabled. | |
bool | get_immediate_callback () const |
Get the status of disabled. | |
bool | get_disabled_by_default () const |
Get the status of disabled by default. | |
bool | get_enabled_by_default () const |
Get the status of disabled by default. | |
bool | get_validate_positionals () const |
Get the status of validating positionals. | |
config_extras_mode | get_allow_config_extras () const |
Get the status of allow extras. | |
Option * | get_help_ptr () |
Get a pointer to the help flag. | |
const Option * | get_help_ptr () const |
Get a pointer to the help flag. (const) | |
const Option * | get_help_all_ptr () const |
Get a pointer to the help all flag. (const) | |
Option * | get_config_ptr () |
Get a pointer to the config option. | |
const Option * | get_config_ptr () const |
Get a pointer to the config option. (const) | |
App * | get_parent () |
Get the parent of this subcommand (or nullptr if master app) | |
const App * | get_parent () const |
Get the parent of this subcommand (or nullptr if master app) (const version) | |
const std::string & | get_name () const |
Get the name of the current app. | |
const std::vector< std::string > & | get_aliases () const |
Get the aliases of the current app. | |
App * | clear_aliases () |
clear all the aliases of the current App | |
std::string | get_display_name () const |
Get a display name for an app. | |
bool | check_name (std::string name_to_check) const |
Check the name, case insensitive and underscore insensitive if set. | |
std::vector< std::string > | get_groups () const |
Get the groups available directly from this option (in order) | |
const std::vector< Option * > & | parse_order () const |
This gets a vector of pointers with the original parse order. | |
std::vector< std::string > | remaining (bool recurse=false) const |
This returns the missing options from the current subcommand. | |
std::vector< std::string > | remaining_for_passthrough (bool recurse=false) const |
This returns the missing options in a form ready for processing by another command line program. | |
std::size_t | remaining_size (bool recurse=false) const |
This returns the number of remaining options, minus the – separator. | |
Protected Member Functions | |
App (std::string app_description, std::string app_name, App *parent) | |
Special private constructor for subcommand. | |
void | _validate () const |
void | _configure () |
void | run_callback (bool final_mode=false) |
Internal function to run (App) callback, bottom up. | |
bool | _valid_subcommand (const std::string ¤t, bool ignore_used=true) const |
Check to see if a subcommand is valid. Give up immediately if subcommand max has been reached. | |
detail::Classifier | _recognize (const std::string ¤t, bool ignore_used_subcommands=true) const |
Selects a Classifier enum based on the type of the current argument. | |
void | _process_config_file () |
Read and process a configuration file (main app only) | |
void | _process_env () |
Get envname options if not yet passed. Runs on all subcommands. | |
void | _process_callbacks () |
Process callbacks. Runs on all subcommands. | |
void | _process_help_flags (bool trigger_help=false, bool trigger_all_help=false) const |
void | _process_requirements () |
Verify required options and cross requirements. Subcommands too (only if selected). | |
void | _process () |
Process callbacks and such. | |
void | _process_extras () |
Throw an error if anything is left over and should not be. | |
void | _process_extras (std::vector< std::string > &args) |
void | increment_parsed () |
Internal function to recursively increment the parsed counter on the current app as well unnamed subcommands. | |
void | _parse (std::vector< std::string > &args) |
Internal parse function. | |
void | _parse (std::vector< std::string > &&args) |
Internal parse function. | |
void | _parse_config (std::vector< ConfigItem > &args) |
bool | _parse_single_config (const ConfigItem &item, std::size_t level=0) |
Fill in a single config option. | |
bool | _parse_single (std::vector< std::string > &args, bool &positional_only) |
std::size_t | _count_remaining_positionals (bool required_only=false) const |
Count the required remaining positional arguments. | |
bool | _has_remaining_positionals () const |
Count the required remaining positional arguments. | |
bool | _parse_positional (std::vector< std::string > &args, bool haltOnSubcommand) |
App * | _find_subcommand (const std::string &subc_name, bool ignore_disabled, bool ignore_used) const noexcept |
bool | _parse_subcommand (std::vector< std::string > &args) |
bool | _parse_arg (std::vector< std::string > &args, detail::Classifier current_type) |
void | _trigger_pre_parse (std::size_t remaining_args) |
Trigger the pre_parse callback if needed. | |
App * | _get_fallthrough_parent () |
Get the appropriate parent to fallthrough to which is the first one that has a name or the main app. | |
const std::string & | _compare_subcommand_names (const App &subcom, const App &base) const |
Helper function to run through all possible comparisons of subcommand names to check there is no overlap. | |
void | _move_to_missing (detail::Classifier val_type, const std::string &val) |
Helper function to place extra values in the most appropriate position. | |
Protected Attributes | |
Basics | |
std::string | name_ {} |
Subcommand name or program name (from parser if name is empty) | |
std::string | description_ {} |
Description of the current program/subcommand. | |
bool | allow_extras_ {false} |
If true, allow extra arguments (ie, don't throw an error). INHERITABLE. | |
config_extras_mode | allow_config_extras_ {config_extras_mode::ignore} |
bool | prefix_command_ {false} |
If true, return immediately on an unrecognized option (implies allow_extras) INHERITABLE. | |
bool | has_automatic_name_ {false} |
If set to true the name was automatically generated from the command line vs a user set name. | |
bool | required_ {false} |
If set to true the subcommand is required to be processed and used, ignored for main app. | |
bool | disabled_ {false} |
If set to true the subcommand is disabled and cannot be used, ignored for main app. | |
bool | pre_parse_called_ {false} |
Flag indicating that the pre_parse_callback has been triggered. | |
bool | immediate_callback_ {false} |
std::function< void(std::size_t)> | pre_parse_callback_ {} |
This is a function that runs prior to the start of parsing. | |
std::function< void()> | parse_complete_callback_ {} |
This is a function that runs when parsing has finished. | |
std::function< void()> | final_callback_ {} |
This is a function that runs when all processing has completed. | |
Options | |
OptionDefaults | option_defaults_ {} |
The default values for options, customizable and changeable INHERITABLE. | |
std::vector< Option_p > | options_ {} |
The list of options, stored locally. | |
Config | |
Option * | config_ptr_ {nullptr} |
Pointer to the config option. | |
std::shared_ptr< Config > | config_formatter_ {new ConfigINI()} |
This is the formatter for help printing. Default provided. INHERITABLE (same pointer) | |
Subcommands | |
enum class | startup_mode : char { stable , enabled , disabled } |
std::vector< App_p > | subcommands_ {} |
Storage for subcommand list. | |
bool | ignore_case_ {false} |
If true, the program name is not case sensitive INHERITABLE. | |
bool | ignore_underscore_ {false} |
If true, the program should ignore underscores INHERITABLE. | |
bool | fallthrough_ {false} |
Allow subcommand fallthrough, so that parent commands can collect commands after subcommand. INHERITABLE. | |
bool | allow_windows_style_options_ |
Allow '/' for options for Windows like options. Defaults to true on Windows, false otherwise. INHERITABLE. | |
bool | positionals_at_end_ {false} |
specify that positional arguments come at the end of the argument sequence not inheritable | |
startup_mode | default_startup {startup_mode::stable} |
bool | configurable_ {false} |
if set to true the subcommand can be triggered via configuration files INHERITABLE | |
bool | validate_positionals_ {false} |
If set to true positional options are validated before assigning INHERITABLE. | |
App * | parent_ {nullptr} |
A pointer to the parent if this is a subcommand. | |
std::size_t | parsed_ {0} |
Counts the number of times this command/subcommand was parsed. | |
std::size_t | require_subcommand_min_ {0} |
Minimum required subcommands (not inheritable!) | |
std::size_t | require_subcommand_max_ {0} |
Max number of subcommands allowed (parsing stops after this number). 0 is unlimited INHERITABLE. | |
std::size_t | require_option_min_ {0} |
Minimum required options (not inheritable!) | |
std::size_t | require_option_max_ {0} |
Max number of options allowed. 0 is unlimited (not inheritable) | |
std::string | group_ {"Subcommands"} |
The group membership INHERITABLE. | |
std::vector< std::string > | aliases_ {} |
Alias names for the subcommand. | |
Parsing | |
using | missing_t = std::vector<std::pair<detail::Classifier, std::string>> |
missing_t | missing_ {} |
std::vector< Option * > | parse_order_ {} |
This is a list of pointers to options with the original parse order. | |
std::vector< App * > | parsed_subcommands_ {} |
This is a list of the subcommands collected, in order. | |
std::set< App * > | exclude_subcommands_ {} |
this is a list of subcommands that are exclusionary to this one | |
std::set< Option * > | exclude_options_ {} |
std::set< App * > | need_subcommands_ {} |
std::set< Option * > | need_options_ {} |
void | clear () |
Reset the parsed data. | |
void | parse (int argc, const char *const *argv) |
void | parse (std::string commandline, bool program_name_included=false) |
void | parse (std::vector< std::string > &args) |
void | parse (std::vector< std::string > &&args) |
The real work is done here. Expects a reversed vector. | |
void | failure_message (std::function< std::string(const App *, const Error &e)> function) |
Provide a function to print a help message. The function gets access to the App pointer and error. | |
int | exit (const Error &e, std::ostream &out=std::cout, std::ostream &err=std::cerr) const |
Print a nice error message and return the exit code. | |
Help | |
std::string | footer_ {} |
Footer to put after all options in the help output INHERITABLE. | |
std::function< std::string()> | footer_callback_ {} |
This is a function that generates a footer to put after all other options in help output. | |
Option * | help_ptr_ {nullptr} |
A pointer to the help flag if there is one INHERITABLE. | |
Option * | help_all_ptr_ {nullptr} |
A pointer to the help all flag if there is one INHERITABLE. | |
std::shared_ptr< FormatterBase > | formatter_ {new Formatter()} |
This is the formatter for help printing. Default provided. INHERITABLE (same pointer) | |
std::function< std::string(const App *, const Error &e)> | failure_message_ {FailureMessage::simple} |
The error message printing function INHERITABLE. | |
App * | footer (std::string footer_string) |
Set footer. | |
App * | footer (std::function< std::string()> footer_function) |
Set footer. | |
std::string | config_to_str (bool default_also=false, bool write_description=false) const |
std::string | help (std::string prev="", AppFormatMode mode=AppFormatMode::Normal) const |
Adding options | |
Option * | add_option (std::string option_name, callback_t option_callback, std::string option_description="", bool defaulted=false, std::function< std::string()> func={}) |
template<typename AssignTo , typename ConvertTo = AssignTo, enable_if_t<!std::is_const< ConvertTo >::value, detail::enabler > = detail::dummy> | |
Option * | add_option (std::string option_name, AssignTo &variable, std::string option_description="", bool defaulted=false) |
Add option for assigning to a variable. | |
template<typename T > | |
Option * | add_option_function (std::string option_name, const std::function< void(const T &)> &func, std::string option_description="") |
Add option for a callback of a specific type. | |
Option * | add_option (std::string option_name) |
Add option with no description or variable assignment. | |
template<typename T , enable_if_t< std::is_const< T >::value &&std::is_constructible< std::string, T >::value, detail::enabler > = detail::dummy> | |
Option * | add_option (std::string option_name, T &option_description) |
Add option with description but with no variable assignment or callback. | |
Option * | set_help_flag (std::string flag_name="", const std::string &help_description="") |
Set a help flag, replace the existing one if present. | |
Option * | set_help_all_flag (std::string help_name="", const std::string &help_description="") |
Set a help all flag, replaced the existing one if present. | |
Option * | add_flag (std::string flag_name) |
Add a flag with no description or variable assignment. | |
template<typename T , enable_if_t< std::is_const< T >::value &&std::is_constructible< std::string, T >::value, detail::enabler > = detail::dummy> | |
Option * | add_flag (std::string flag_name, T &flag_description) |
template<typename T , enable_if_t< std::is_integral< T >::value &&!is_bool< T >::value, detail::enabler > = detail::dummy> | |
Option * | add_flag (std::string flag_name, T &flag_count, std::string flag_description="") |
template<typename T , enable_if_t<!is_vector< T >::value &&!std::is_const< T >::value &&(!std::is_integral< T >::value||is_bool< T >::value) &&!std::is_constructible< std::function< void(int)>, T >::value, detail::enabler > = detail::dummy> | |
Option * | add_flag (std::string flag_name, T &flag_result, std::string flag_description="") |
template<typename T , enable_if_t<!std::is_assignable< std::function< void(int64_t)>, T >::value, detail::enabler > = detail::dummy> | |
Option * | add_flag (std::string flag_name, std::vector< T > &flag_results, std::string flag_description="") |
Vector version to capture multiple flags. | |
Option * | add_flag_callback (std::string flag_name, std::function< void(void)> function, std::string flag_description="") |
Add option for callback that is triggered with a true flag and takes no arguments. | |
Option * | add_flag_function (std::string flag_name, std::function< void(int64_t)> function, std::string flag_description="") |
Add option for callback with an integer value. | |
template<typename T > | |
Option * | add_set (std::string option_name, T &member, std::set< T > options, std::string option_description="") |
Add set of options (No default, temp reference, such as an inline set) DEPRECATED. | |
template<typename T > | |
Option * | add_mutable_set (std::string option_name, T &member, const std::set< T > &options, std::string option_description="") |
Add set of options (No default, set can be changed afterwards - do not destroy the set) DEPRECATED. | |
template<typename T > | |
Option * | add_set (std::string option_name, T &member, std::set< T > options, std::string option_description, bool defaulted) |
Add set of options (with default, static set, such as an inline set) DEPRECATED. | |
template<typename T > | |
Option * | add_mutable_set (std::string option_name, T &member, const std::set< T > &options, std::string option_description, bool defaulted) |
Add set of options (with default, set can be changed afterwards - do not destroy the set) DEPRECATED. | |
template<typename T , typename XC = double> | |
Option * | add_complex (std::string option_name, T &variable, std::string option_description="", bool defaulted=false, std::string label="COMPLEX") |
Add a complex number. | |
Option * | set_config (std::string option_name="", std::string default_filename="", const std::string &help_message="Read an ini file", bool config_required=false) |
Set a configuration ini file option, or clear it if no name passed. | |
bool | remove_option (Option *opt) |
Removes an option from the App. Takes an option pointer. Returns true if found and removed. | |
template<typename T = Option_group> | |
T * | add_option_group (std::string group_name, std::string group_description="") |
creates an option group as part of the given app | |
To use, create a new Program()
instance with argc
, argv
, and a help description. The templated add_option methods make it easy to prepare options. Remember to call .start
before starting your program, so that the options can be evaluated and the help option doesn't accidentally run your program.
|
protected |
|
strongprotected |
|
inlineprotected |
Definition at line 4803 of file CLI11.hpp.
|
inlineexplicit |
Definition at line 4841 of file CLI11.hpp.
|
delete |
|
virtualdefault |
|
inlineprotected |
Definition at line 7309 of file CLI11.hpp.
|
inlineprotected |
configure subcommands to enable parsing through the current object set the correct fallthrough and prefix for nameless subcommands and manage the automatic enable or disable makes sure parent is set correctly
Definition at line 6419 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6957 of file CLI11.hpp.
|
inlineprotectednoexcept |
Locate a subcommand by name with two conditions, should disabled subcommands be ignored, and should used subcommands be ignored
Definition at line 7085 of file CLI11.hpp.
|
inlineprotected |
Definition at line 7297 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6971 of file CLI11.hpp.
Definition at line 7377 of file CLI11.hpp.
|
inlineprotected |
Definition at line 7359 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6824 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6795 of file CLI11.hpp.
|
inlineprotected |
Parse a short (false) or long (true) argument, must be at the top of the list return true if the argument was processed or false if nothing was done
Definition at line 7133 of file CLI11.hpp.
|
inlineprotected |
Parse one config param, return false if not found in any subcommand, remove if it is
If this has more than one dot.separated.name, go into the subcommand matching it Returns true if it managed to find the option, if false you'll need to remove the arg manually.
Definition at line 6844 of file CLI11.hpp.
|
inlineprotected |
Parse a positional, go up the tree to check
haltOnSubcommand | if set to true the operation will not process subcommands merely return false Return true if the positional was used false otherwise |
Try to find a local subcommand that is repeated
now try one last gasp at subcommands that have been executed before, go to root app and try to find a subcommand in a broader way, if one exists let the parent deal with it
If this is an option group don't deal with it
We are out of other options this goes to missing
Definition at line 6984 of file CLI11.hpp.
|
inlineprotected |
Parse "one" argument (some may eat more than one), delegate to parent if fails, add to missing if missing from master return false if the parse has failed and needs to return to parent
Definition at line 6914 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6852 of file CLI11.hpp.
|
inlineprotected |
Parse a subcommand, modify args and continue
Unlike the others, this one will always allow fallthrough return true if the subcommand was processed false otherwise
Definition at line 7107 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6746 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6570 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6506 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6537 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6755 of file CLI11.hpp.
|
inlineprotected |
Throw an error if anything is left over and should not be. Modifies the args to fill in the missing items before throwing.
Definition at line 6771 of file CLI11.hpp.
|
inlineprotected |
Run help flag processing if any are found.
The flags allow recursive calls to remember if there was a help flag on a parent.
Definition at line 6597 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6620 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6479 of file CLI11.hpp.
|
inlineprotected |
Definition at line 7278 of file CLI11.hpp.
|
inlineprotected |
Definition at line 6465 of file CLI11.hpp.
|
inlineprotected |
Check the options to make sure there are no conflicts.
Currently checks to see if multiple positionals exist with unlimited args and checks if the min and max options are feasible
Definition at line 6380 of file CLI11.hpp.
|
inline |
Definition at line 5425 of file CLI11.hpp.
|
inline |
|
inline |
flag_results | A vector of values with the flag results |
Definition at line 5317 of file CLI11.hpp.
|
inline |
Add option for flag with integer result - defaults to allowing multiple passings, but can be forced to one if multi_option_policy(CLI::MultiOptionPolicy::Throw)
is used.
flag_count | A variable holding the count |
Definition at line 5281 of file CLI11.hpp.
|
inline |
Add flag with description but with no variable assignment or callback takes a constant string, if a variable string is passed that variable will be assigned the results from the flag
|
inline |
Other type version accepts all other types that are not vectors such as bool, enum, string or other classes that can be converted from a string
flag_result | A variable holding true if passed |
Definition at line 5304 of file CLI11.hpp.
|
inline |
function | A function to call, void(void) |
Definition at line 5334 of file CLI11.hpp.
|
inline |
function | A function to call, void(int) |
Definition at line 5350 of file CLI11.hpp.
|
inline |
member | The selected member of the set |
options | The set of possibilities |
Definition at line 5412 of file CLI11.hpp.
|
inline |
member | The selected member of the set |
options | The set of possibilities |
Definition at line 5387 of file CLI11.hpp.
|
inline |
|
inline |
variable | The variable to set |
Definition at line 5144 of file CLI11.hpp.
|
inline |
Add an option, will automatically understand the type for common types.
To use, create a variable with the expected type, and pass it in after the name. After start is called, you can use count to see if the value was passed, and the value will be initialized properly. Numbers, vectors, and strings are supported.
->required(), ->default, and the validators are options, The positional options take an optional number of arguments.
For example,
std::string filename; program.add_option("filename", filename, "description of filename");
Definition at line 5099 of file CLI11.hpp.
|
inline |
|
inline |
func | the callback to execute |
Definition at line 5169 of file CLI11.hpp.
|
inline |
Definition at line 5524 of file CLI11.hpp.
|
inline |
member | The selected member of the set |
options | The set of possibilities |
Definition at line 5399 of file CLI11.hpp.
|
inline |
member | The selected member of the set |
options | The set of possibilities |
Definition at line 5375 of file CLI11.hpp.
|
inline |
Definition at line 5547 of file CLI11.hpp.
|
inline |
Definition at line 5538 of file CLI11.hpp.
|
inline |
Definition at line 4907 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Allow windows style options, such as /opt
. First matching short or long name used. Subcommands inherit value.
|
inline |
Set a callback for execution when all parsing and processing has completed
Due to a bug in c++11, it is not possible to overload on std::function (fixed in c++14 and backported to c++11 on newer compilers). Use capture by reference to get a pointer to App if needed.
Definition at line 4858 of file CLI11.hpp.
|
inline |
Definition at line 6279 of file CLI11.hpp.
|
inline |
Definition at line 5752 of file CLI11.hpp.
|
inline |
|
inline |
Produce a string that could be read in as a config of the current values of the App. Set default_also to include default arguments. Prefix will add a string to the beginning of each option.
|
inline |
|
inline |
|
inline |
Definition at line 5889 of file CLI11.hpp.
|
inline |
Get a count of all the arguments processed in options and subcommands, this excludes arguments which were treated as extras.
Definition at line 5649 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
Definition at line 4945 of file CLI11.hpp.
|
inline |
Set the subcommand to be enabled by default, so on clear(), at the start of each parse it is enabled (not disabled)
Definition at line 4956 of file CLI11.hpp.
|
inline |
Avoid printing anything if this is a CLI::RuntimeError
Definition at line 5860 of file CLI11.hpp.
|
inline |
|
inline |
Stop subcommand fallthrough, so that parent commands cannot collect commands after subcommand. Default from parent, usually set on parent.
|
inline |
Set a callback for execution when all parsing and processing has completed aliased as callback
|
inline |
Definition at line 6035 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 6276 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
Definition at line 6308 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
Definition at line 6138 of file CLI11.hpp.
|
inlinenoexcept |
Definition at line 6119 of file CLI11.hpp.
|
inline |
Definition at line 6086 of file CLI11.hpp.
|
inline |
Definition at line 6103 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 6223 of file CLI11.hpp.
Check to see if a subcommand is part of this command (doesn't have to be in command line) returns the first subcommand if passed a nullptr
Definition at line 5578 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get a filtered subcommand pointer list from the original definition list. An empty function will provide all subcommands
Definition at line 5915 of file CLI11.hpp.
|
inline |
Get a filtered subcommand pointer list from the original definition list. An empty function will provide all subcommands (const)
Definition at line 5897 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Makes a help message, using the currently configured formatter Will only do one subcommand at a time
Definition at line 6047 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
Definition at line 4967 of file CLI11.hpp.
|
inlineprotected |
|
inline |
Definition at line 4889 of file CLI11.hpp.
Definition at line 5972 of file CLI11.hpp.
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
Parses the command line - throws errors. This must be called after the options are in but before the rest of the program.
Definition at line 5769 of file CLI11.hpp.
|
inline |
Parse a single string as if it contained command line arguments. This function splits the string into arguments then calls parse(std::vector<std::string> &) the function takes an optional boolean argument specifying if the programName is included in the string to process
Definition at line 5787 of file CLI11.hpp.
|
inline |
Definition at line 5835 of file CLI11.hpp.
|
inline |
The real work is done here. Expects a reversed vector. Changes the vector to the remaining options.
Definition at line 5815 of file CLI11.hpp.
|
inline |
Set a callback to execute when parsing has completed for the app
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
Definition at line 6325 of file CLI11.hpp.
|
inline |
|
inline |
Definition at line 6359 of file CLI11.hpp.
|
inline |
Definition at line 5994 of file CLI11.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 5501 of file CLI11.hpp.
|
inline |
Definition at line 5561 of file CLI11.hpp.
|
inline |
|
inline |
Require an option to be given (does not affect help call) The number required can be given. Negative values indicate maximum number allowed (0 for any number).
|
inline |
Explicitly control the number of options required. Setting 0 for the max means unlimited number allowed. Max number inheritable.
|
inline |
|
inline |
Require a subcommand to be given (does not affect help call) The number required can be given. Negative values indicate maximum number allowed (0 for any number). Max number inheritable.
|
inline |
Explicitly control the number of subcommands required. Setting 0 for the max means unlimited number allowed. Max number inheritable.
|
inline |
|
inlineprotected |
Definition at line 6439 of file CLI11.hpp.
|
inline |
Definition at line 5474 of file CLI11.hpp.
|
inline |
Definition at line 5220 of file CLI11.hpp.
|
inline |
Definition at line 5203 of file CLI11.hpp.
|
inline |
|
protected |
|
protected |
If ignore, allow extra arguments in the ini file (ie, don't throw an error). INHERITABLE if error error on an extra argument, and if capture feed it to the app
Definition at line 4635 of file CLI11.hpp.
|
protected |
|
protected |
Definition at line 4798 of file CLI11.hpp.
|
protected |
|
protected |
|
protected |
specify the startup mode for the app stable=no change, enabled= startup enabled, disabled=startup disabled
Definition at line 4758 of file CLI11.hpp.
|
protected |
|
protected |
|
protected |
Definition at line 4694 of file CLI11.hpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |