|
void | _move_option (Option *opt, App *app) |
| function that could be used by subclasses of App to shift options around into subcommands More...
|
|
|
| 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. More...
|
|
| App (const App &)=delete |
| Create a new program. Pass in the same arguments as main(), along with a help string. More...
|
|
App & | operator= (const App &)=delete |
| Create a new program. Pass in the same arguments as main(), along with a help string. More...
|
|
virtual | ~App ()=default |
| virtual destructor More...
|
|
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) More...
|
|
App * | alias (std::string app_name) |
| Set an alias for the app. More...
|
|
App * | allow_extras (bool allow=true) |
| Remove the error when extras are left over on the command line. More...
|
|
App * | required (bool require=true) |
| Remove the error when extras are left over on the command line. More...
|
|
App * | disabled (bool disable=true) |
| Disable the subcommand or option group. More...
|
|
App * | silent (bool silence=true) |
| silence the subcommand from showing up in the processed list More...
|
|
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. More...
|
|
App * | enabled_by_default (bool enable=true) |
|
App * | immediate_callback (bool immediate=true) |
| Set the subcommand callback to be executed immediately on subcommand completion. More...
|
|
App * | validate_positionals (bool validate=true) |
| Set the subcommand to validate positional arguments before assigning. More...
|
|
App * | validate_optional_arguments (bool validate=true) |
| Set the subcommand to validate optional vector arguments before assigning. More...
|
|
App * | allow_config_extras (bool allow=true) |
| ignore extras in config files More...
|
|
App * | allow_config_extras (config_extras_mode mode) |
| ignore extras in config files More...
|
|
App * | prefix_command (bool allow=true) |
| Do not parse anything after the first unrecognized option and return. More...
|
|
App * | ignore_case (bool value=true) |
| Ignore case. Subcommands inherit value. More...
|
|
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. More...
|
|
App * | configurable (bool value=true) |
| Specify that the subcommand can be triggered by a config file. More...
|
|
App * | ignore_underscore (bool value=true) |
| Ignore underscore. Subcommands inherit value. More...
|
|
App * | formatter (std::shared_ptr< FormatterBase > fmt) |
| Set the help formatter. More...
|
|
App * | formatter_fn (std::function< std::string(const App *, std::string, AppFormatMode)> fmt) |
| Set the help formatter. More...
|
|
App * | config_formatter (std::shared_ptr< Config > fmt) |
| Set the config formatter. More...
|
|
CLI11_NODISCARD bool | parsed () const |
| Check to see if this subcommand was parsed, true only if received on command line. More...
|
|
OptionDefaults * | option_defaults () |
| Get the OptionDefault object, to set option defaults. More...
|
|
|
virtual void | pre_callback () |
|
|
CLI11_NODISCARD std::size_t | count (std::string option_name) const |
| Counts the number of times the given option was passed. More...
|
|
CLI11_NODISCARD 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. More...
|
|
CLI11_NODISCARD bool | got_subcommand (std::string subcommand_name) const |
| Check with name instead of pointer to see if subcommand was selected. More...
|
|
App * | excludes (Option *opt) |
| Sets excluded options for the subcommand. More...
|
|
App * | excludes (App *app) |
| Sets excluded subcommands for the subcommand. More...
|
|
App * | needs (Option *opt) |
| Counts the number of times the given option was passed. More...
|
|
App * | needs (App *app) |
| Counts the number of times the given option was passed. More...
|
|
bool | remove_excludes (Option *opt) |
| Removes an option from the excludes list of this subcommand. More...
|
|
bool | remove_excludes (App *app) |
| Removes a subcommand from the excludes list of this subcommand. More...
|
|
bool | remove_needs (Option *opt) |
| Removes an option from the needs list of this subcommand. More...
|
|
bool | remove_needs (App *app) |
| Removes a subcommand from the needs list of this subcommand. More...
|
|
|
CLI11_NODISCARD
std::shared_ptr< FormatterBase > | get_formatter () const |
| Access the formatter. More...
|
|
CLI11_NODISCARD
std::shared_ptr< Config > | get_config_formatter () const |
| Access the config formatter. More...
|
|
CLI11_NODISCARD
std::shared_ptr< ConfigBase > | get_config_formatter_base () const |
| Access the config formatter as a configBase pointer. More...
|
|
CLI11_NODISCARD std::string | get_description () const |
| Get the app or subcommand description. More...
|
|
App * | description (std::string app_description) |
| Set the description of the app. More...
|
|
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. More...
|
|
std::vector< Option * > | get_options (const std::function< bool(Option *)> filter={}) |
| Non-const version of the above. More...
|
|
Option * | get_option_no_throw (std::string option_name) noexcept |
| Get an option by name (noexcept non-const version) More...
|
|
CLI11_NODISCARD const Option * | get_option_no_throw (std::string option_name) const noexcept |
| Get an option by name (noexcept const version) More...
|
|
CLI11_NODISCARD const Option * | get_option (std::string option_name) const |
| Get an option by name. More...
|
|
Option * | get_option (std::string option_name) |
| Get an option by name (non-const version) More...
|
|
const Option * | operator[] (const std::string &option_name) const |
| Shortcut bracket operator for getting a pointer to an option. More...
|
|
const Option * | operator[] (const char *option_name) const |
| Shortcut bracket operator for getting a pointer to an option. More...
|
|
CLI11_NODISCARD bool | get_ignore_case () const |
| Check the status of ignore_case. More...
|
|
CLI11_NODISCARD bool | get_ignore_underscore () const |
| Check the status of ignore_underscore. More...
|
|
CLI11_NODISCARD bool | get_fallthrough () const |
| Check the status of fallthrough. More...
|
|
CLI11_NODISCARD bool | get_allow_windows_style_options () const |
| Check the status of the allow windows style options. More...
|
|
CLI11_NODISCARD bool | get_positionals_at_end () const |
| Check the status of the allow windows style options. More...
|
|
CLI11_NODISCARD bool | get_configurable () const |
| Check the status of the allow windows style options. More...
|
|
CLI11_NODISCARD const std::string & | get_group () const |
| Get the group of this subcommand. More...
|
|
CLI11_NODISCARD std::string | get_footer () const |
| Generate and return the footer. More...
|
|
CLI11_NODISCARD std::size_t | get_require_subcommand_min () const |
| Get the required min subcommand value. More...
|
|
CLI11_NODISCARD std::size_t | get_require_subcommand_max () const |
| Get the required max subcommand value. More...
|
|
CLI11_NODISCARD std::size_t | get_require_option_min () const |
| Get the required min option value. More...
|
|
CLI11_NODISCARD std::size_t | get_require_option_max () const |
| Get the required max option value. More...
|
|
CLI11_NODISCARD bool | get_prefix_command () const |
| Get the prefix command status. More...
|
|
CLI11_NODISCARD bool | get_allow_extras () const |
| Get the status of allow extras. More...
|
|
CLI11_NODISCARD bool | get_required () const |
| Get the status of required. More...
|
|
CLI11_NODISCARD bool | get_disabled () const |
| Get the status of disabled. More...
|
|
CLI11_NODISCARD bool | get_silent () const |
| Get the status of silence. More...
|
|
CLI11_NODISCARD bool | get_immediate_callback () const |
| Get the status of disabled. More...
|
|
CLI11_NODISCARD bool | get_disabled_by_default () const |
| Get the status of disabled by default. More...
|
|
CLI11_NODISCARD bool | get_enabled_by_default () const |
| Get the status of disabled by default. More...
|
|
CLI11_NODISCARD bool | get_validate_positionals () const |
| Get the status of validating positionals. More...
|
|
CLI11_NODISCARD bool | get_validate_optional_arguments () const |
| Get the status of validating optional vector arguments. More...
|
|
CLI11_NODISCARD config_extras_mode | get_allow_config_extras () const |
| Get the status of allow extras. More...
|
|
Option * | get_help_ptr () |
| Get a pointer to the help flag. More...
|
|
CLI11_NODISCARD const Option * | get_help_ptr () const |
| Get a pointer to the help flag. (const) More...
|
|
CLI11_NODISCARD const Option * | get_help_all_ptr () const |
| Get a pointer to the help all flag. (const) More...
|
|
Option * | get_config_ptr () |
| Get a pointer to the config option. More...
|
|
CLI11_NODISCARD const Option * | get_config_ptr () const |
| Get a pointer to the config option. (const) More...
|
|
Option * | get_version_ptr () |
| Get a pointer to the version option. More...
|
|
CLI11_NODISCARD const Option * | get_version_ptr () const |
| Get a pointer to the version option. (const) More...
|
|
App * | get_parent () |
| Get the parent of this subcommand (or nullptr if main app) More...
|
|
CLI11_NODISCARD const App * | get_parent () const |
| Get the parent of this subcommand (or nullptr if main app) (const version) More...
|
|
CLI11_NODISCARD const std::string & | get_name () const |
| Get the name of the current app. More...
|
|
CLI11_NODISCARD const
std::vector< std::string > & | get_aliases () const |
| Get the aliases of the current app. More...
|
|
App * | clear_aliases () |
| clear all the aliases of the current App More...
|
|
CLI11_NODISCARD std::string | get_display_name (bool with_aliases=false) const |
| Get a display name for an app. More...
|
|
CLI11_NODISCARD bool | check_name (std::string name_to_check) const |
| Check the name, case insensitive and underscore insensitive if set. More...
|
|
CLI11_NODISCARD std::vector
< std::string > | get_groups () const |
| Get the groups available directly from this option (in order) More...
|
|
CLI11_NODISCARD const
std::vector< Option * > & | parse_order () const |
| This gets a vector of pointers with the original parse order. More...
|
|
CLI11_NODISCARD std::vector
< std::string > | remaining (bool recurse=false) const |
| This returns the missing options from the current subcommand. More...
|
|
CLI11_NODISCARD 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. More...
|
|
CLI11_NODISCARD std::size_t | remaining_size (bool recurse=false) const |
| This returns the number of remaining options, minus the – separator. More...
|
|
|
| App (std::string app_description, std::string app_name, App *parent) |
| Special private constructor for subcommand. More...
|
|
void | _validate () const |
|
void | _configure () |
|
void | run_callback (bool final_mode=false, bool suppress_final_callback=false) |
| Internal function to run (App) callback, bottom up. More...
|
|
CLI11_NODISCARD 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. More...
|
|
CLI11_NODISCARD 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. More...
|
|
void | _process_config_file () |
| Read and process a configuration file (main app only) More...
|
|
void | _process_env () |
| Get envname options if not yet passed. Runs on all subcommands. More...
|
|
void | _process_callbacks () |
| Process callbacks. Runs on all subcommands. More...
|
|
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). More...
|
|
void | _process () |
| Process callbacks and such. More...
|
|
void | _process_extras () |
| Throw an error if anything is left over and should not be. More...
|
|
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. More...
|
|
void | _parse (std::vector< std::string > &args) |
| Internal parse function. More...
|
|
void | _parse (std::vector< std::string > &&args) |
| Internal parse function. More...
|
|
void | _parse_stream (std::istream &input) |
| Internal function to parse a stream. More...
|
|
void | _parse_config (const std::vector< ConfigItem > &args) |
|
bool | _parse_single_config (const ConfigItem &item, std::size_t level=0) |
| Fill in a single config option. More...
|
|
bool | _parse_single (std::vector< std::string > &args, bool &positional_only) |
|
CLI11_NODISCARD std::size_t | _count_remaining_positionals (bool required_only=false) const |
| Count the required remaining positional arguments. More...
|
|
CLI11_NODISCARD bool | _has_remaining_positionals () const |
| Count the required remaining positional arguments. More...
|
|
bool | _parse_positional (std::vector< std::string > &args, bool haltOnSubcommand) |
|
CLI11_NODISCARD 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. More...
|
|
App * | _get_fallthrough_parent () |
| Get the appropriate parent to fallthrough to which is the first one that has a name or the main app. More...
|
|
CLI11_NODISCARD 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. More...
|
|
void | _move_to_missing (detail::Classifier val_type, const std::string &val) |
| Helper function to place extra values in the most appropriate position. More...
|
|
|
enum | startup_mode : char { startup_mode::stable,
startup_mode::enabled,
startup_mode::disabled
} |
| Storage for subcommand list. More...
|
|
std::vector< App_p > | subcommands_ {} |
| Storage for subcommand list. More...
|
|
bool | ignore_case_ {false} |
| If true, the program name is not case sensitive INHERITABLE. More...
|
|
bool | ignore_underscore_ {false} |
| If true, the program should ignore underscores INHERITABLE. More...
|
|
bool | fallthrough_ {false} |
| Allow subcommand fallthrough, so that parent commands can collect commands after subcommand. INHERITABLE. More...
|
|
bool | allow_windows_style_options_ |
| Allow '/' for options for Windows like options. Defaults to true on Windows, false otherwise. INHERITABLE. More...
|
|
bool | positionals_at_end_ {false} |
| specify that positional arguments come at the end of the argument sequence not inheritable More...
|
|
startup_mode | default_startup {startup_mode::stable} |
|
bool | configurable_ {false} |
| if set to true the subcommand can be triggered via configuration files INHERITABLE More...
|
|
bool | validate_positionals_ {false} |
| If set to true positional options are validated before assigning INHERITABLE. More...
|
|
bool | validate_optional_arguments_ {false} |
| If set to true optional vector arguments are validated before assigning INHERITABLE. More...
|
|
bool | silent_ {false} |
|
std::uint32_t | parsed_ {0U} |
| Counts the number of times this command/subcommand was parsed. More...
|
|
std::size_t | require_subcommand_min_ {0} |
| Minimum required subcommands (not inheritable!) More...
|
|
std::size_t | require_subcommand_max_ {0} |
| Max number of subcommands allowed (parsing stops after this number). 0 is unlimited INHERITABLE. More...
|
|
std::size_t | require_option_min_ {0} |
| Minimum required options (not inheritable!) More...
|
|
std::size_t | require_option_max_ {0} |
| Max number of options allowed. 0 is unlimited (not inheritable) More...
|
|
App * | parent_ {nullptr} |
| A pointer to the parent if this is a subcommand. More...
|
|
std::string | group_ {"Subcommands"} |
| The group membership INHERITABLE. More...
|
|
std::vector< std::string > | aliases_ {} |
| Alias names for the subcommand. More...
|
|
App * | add_subcommand (std::string subcommand_name="", std::string subcommand_description="") |
| Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag. More...
|
|
App * | add_subcommand (CLI::App_p subcom) |
| Add a previously created app as a subcommand. More...
|
|
bool | remove_subcommand (App *subcom) |
| Removes a subcommand from the App. Takes a subcommand pointer. Returns true if found and removed. More...
|
|
App * | get_subcommand (const App *subcom) const |
|
CLI11_NODISCARD App * | get_subcommand (std::string subcom) const |
| Check to see if a subcommand is part of this command (text version) More...
|
|
CLI11_NODISCARD App * | get_subcommand (int index=0) const |
| Get a pointer to subcommand by index. More...
|
|
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. More...
|
|
CLI11_NODISCARD CLI::App_p | get_subcommand_ptr (std::string subcom) const |
| Check to see if a subcommand is part of this command (text version) More...
|
|
CLI11_NODISCARD CLI::App_p | get_subcommand_ptr (int index=0) const |
| Get an owning pointer to subcommand by index. More...
|
|
CLI11_NODISCARD App * | get_option_group (std::string group_name) const |
| Check to see if an option group is part of this App. More...
|
|
CLI11_NODISCARD std::size_t | count () const |
|
CLI11_NODISCARD std::size_t | count_all () const |
|
App * | group (std::string group_name) |
| Changes the group membership. More...
|
|
App * | require_subcommand () |
| The argumentless form of require subcommand requires 1 or more subcommands. More...
|
|
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. More...
|
|
App * | require_option (int value) |
|
App * | require_option (std::size_t min, std::size_t max) |
|
App * | fallthrough (bool value=true) |
|
| operator bool () const |
|
|
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="") |
| Add option for assigning to a variable. More...
|
|
template<typename AssignTo , enable_if_t<!std::is_const< AssignTo >::value, detail::enabler > = detail::dummy> |
Option * | add_option_no_stream (std::string option_name, AssignTo &variable, std::string option_description="") |
| Add option for assigning to a variable. More...
|
|
template<typename ArgType > |
Option * | add_option_function (std::string option_name, const std::function< void(const ArgType &)> &func, std::string option_description="") |
| Add option for a callback of a specific type. More...
|
|
Option * | add_option (std::string option_name) |
| Add option with no description or variable assignment. More...
|
|
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. More...
|
|
Option * | set_help_flag (std::string flag_name="", const std::string &help_description="") |
| Set a help flag, replace the existing one if present. More...
|
|
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. More...
|
|
Option * | set_version_flag (std::string flag_name="", const std::string &versionString="", const std::string &version_help="Display program version information and exit") |
| Set a version flag and version display string, replace the existing one if present. More...
|
|
Option * | set_version_flag (std::string flag_name, std::function< std::string()> vfunc, const std::string &version_help="Display program version information and exit") |
| Generate the version string through a callback function. More...
|
|
Option * | add_flag (std::string flag_name) |
| Add a flag with no description or variable assignment. More...
|
|
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<!detail::is_mutable_container< T >::value &&!std::is_const< 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(std::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. More...
|
|
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. More...
|
|
Option * | add_flag_function (std::string flag_name, std::function< void(std::int64_t)> function, std::string flag_description="") |
| Add option for callback with an integer value. More...
|
|
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. More...
|
|
bool | remove_option (Option *opt) |
| Removes an option from the App. Takes an option pointer. Returns true if found and removed. More...
|
|
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 More...
|
|
Creates a command line program, with very few defaults.
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.
Definition at line 5605 of file CLI11.h.