HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pxr_CLI::CLI::App Class Reference

Creates a command line program, with very few defaults. More...

#include <CLI11.h>

+ Inheritance diagram for pxr_CLI::CLI::App:

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 More...
 
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. More...
 
 App (const App &)=delete
 Create a new program. Pass in the same arguments as main(), along with a help string. More...
 
Appoperator= (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...
 
Appcallback (std::function< void()> app_callback)
 
Appfinal_callback (std::function< void()> app_callback)
 
Appparse_complete_callback (std::function< void()> pc_callback)
 
Apppreparse_callback (std::function< void(std::size_t)> pp_callback)
 
Appname (std::string app_name="")
 Set a name for the app (empty will use parser to set the name) More...
 
Appalias (std::string app_name)
 Set an alias for the app. More...
 
Appallow_extras (bool allow=true)
 Remove the error when extras are left over on the command line. More...
 
Apprequired (bool require=true)
 Remove the error when extras are left over on the command line. More...
 
Appdisabled (bool disable=true)
 Disable the subcommand or option group. More...
 
Appsilent (bool silence=true)
 silence the subcommand from showing up in the processed list More...
 
Appdisabled_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...
 
Appenabled_by_default (bool enable=true)
 
Appimmediate_callback (bool immediate=true)
 Set the subcommand callback to be executed immediately on subcommand completion. More...
 
Appvalidate_positionals (bool validate=true)
 Set the subcommand to validate positional arguments before assigning. More...
 
Appvalidate_optional_arguments (bool validate=true)
 Set the subcommand to validate optional vector arguments before assigning. More...
 
Appallow_config_extras (bool allow=true)
 ignore extras in config files More...
 
Appallow_config_extras (config_extras_mode mode)
 ignore extras in config files More...
 
Appprefix_command (bool allow=true)
 Do not parse anything after the first unrecognized option and return. More...
 
Appignore_case (bool value=true)
 Ignore case. Subcommands inherit value. More...
 
Appallow_windows_style_options (bool value=true)
 
Apppositionals_at_end (bool value=true)
 Specify that the positional arguments are only at the end of the sequence. More...
 
Appconfigurable (bool value=true)
 Specify that the subcommand can be triggered by a config file. More...
 
Appignore_underscore (bool value=true)
 Ignore underscore. Subcommands inherit value. More...
 
Appformatter (std::shared_ptr< FormatterBase > fmt)
 Set the help formatter. More...
 
Appformatter_fn (std::function< std::string(const App *, std::string, AppFormatMode)> fmt)
 Set the help formatter. More...
 
Appconfig_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...
 
OptionDefaultsoption_defaults ()
 Get the OptionDefault object, to set option defaults. More...
 
Extras for subclassing
virtual void pre_callback ()
 
Post parsing
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...
 
Appexcludes (Option *opt)
 Sets excluded options for the subcommand. More...
 
Appexcludes (App *app)
 Sets excluded subcommands for the subcommand. More...
 
Appneeds (Option *opt)
 Counts the number of times the given option was passed. More...
 
Appneeds (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...
 
Getters
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...
 
Appdescription (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...
 
Optionget_option_no_throw (std::string option_name) noexcept
 Get an option by name (noexcept non-const version) More...
 
CLI11_NODISCARD const Optionget_option_no_throw (std::string option_name) const noexcept
 Get an option by name (noexcept const version) More...
 
CLI11_NODISCARD const Optionget_option (std::string option_name) const
 Get an option by name. More...
 
Optionget_option (std::string option_name)
 Get an option by name (non-const version) More...
 
const Optionoperator[] (const std::string &option_name) const
 Shortcut bracket operator for getting a pointer to an option. More...
 
const Optionoperator[] (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::stringget_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...
 
Optionget_help_ptr ()
 Get a pointer to the help flag. More...
 
CLI11_NODISCARD const Optionget_help_ptr () const
 Get a pointer to the help flag. (const) More...
 
CLI11_NODISCARD const Optionget_help_all_ptr () const
 Get a pointer to the help all flag. (const) More...
 
Optionget_config_ptr ()
 Get a pointer to the config option. More...
 
CLI11_NODISCARD const Optionget_config_ptr () const
 Get a pointer to the config option. (const) More...
 
Optionget_version_ptr ()
 Get a pointer to the version option. More...
 
CLI11_NODISCARD const Optionget_version_ptr () const
 Get a pointer to the version option. (const) More...
 
Appget_parent ()
 Get the parent of this subcommand (or nullptr if main app) More...
 
CLI11_NODISCARD const Appget_parent () const
 Get the parent of this subcommand (or nullptr if main app) (const version) More...
 
CLI11_NODISCARD const std::stringget_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...
 
Appclear_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...
 

Protected Member Functions

 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 &current, 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 &current, 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...
 

Protected Attributes

Basics
std::string name_ {}
 Subcommand name or program name (from parser if name is empty) More...
 
std::string description_ {}
 Description of the current program/subcommand. More...
 
bool allow_extras_ {false}
 If true, allow extra arguments (ie, don't throw an error). INHERITABLE. More...
 
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. More...
 
bool has_automatic_name_ {false}
 If set to true the name was automatically generated from the command line vs a user set name. More...
 
bool required_ {false}
 If set to true the subcommand is required to be processed and used, ignored for main app. More...
 
bool disabled_ {false}
 If set to true the subcommand is disabled and cannot be used, ignored for main app. More...
 
bool pre_parse_called_ {false}
 Flag indicating that the pre_parse_callback has been triggered. More...
 
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. More...
 
std::function< void()> parse_complete_callback_ {}
 This is a function that runs when parsing has finished. More...
 
std::function< void()> final_callback_ {}
 This is a function that runs when all processing has completed. More...
 
Options
OptionDefaults option_defaults_ {}
 The default values for options, customizable and changeable INHERITABLE. More...
 
std::vector< Option_poptions_ {}
 The list of options, stored locally. More...
 
Config
Optionconfig_ptr_ {nullptr}
 Pointer to the config option. More...
 
std::shared_ptr< Configconfig_formatter_ {new ConfigTOML()}
 This is the formatter for help printing. Default provided. INHERITABLE (same pointer) More...
 

Help

std::string footer_ {}
 Footer to put after all options in the help output INHERITABLE. More...
 
std::function< std::string()> footer_callback_ {}
 This is a function that generates a footer to put after all other options in help output. More...
 
Optionhelp_ptr_ {nullptr}
 A pointer to the help flag if there is one INHERITABLE. More...
 
Optionhelp_all_ptr_ {nullptr}
 A pointer to the help all flag if there is one INHERITABLE. More...
 
Optionversion_ptr_ {nullptr}
 A pointer to a version flag if there is one. More...
 
std::shared_ptr< FormatterBaseformatter_ {new Formatter()}
 This is the formatter for help printing. Default provided. INHERITABLE (same pointer) More...
 
std::function< std::string(const
App *, const Error &e)> 
failure_message_ {FailureMessage::simple}
 The error message printing function INHERITABLE. More...
 
Appfooter (std::string footer_string)
 Set footer. More...
 
Appfooter (std::function< std::string()> footer_function)
 Set footer. More...
 
CLI11_NODISCARD std::string config_to_str (bool default_also=false, bool write_description=false) const
 
CLI11_NODISCARD std::string help (std::string prev="", AppFormatMode mode=AppFormatMode::Normal) const
 
CLI11_NODISCARD std::string version () const
 Displays a version string. More...
 

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. More...
 
std::vector< App * > parsed_subcommands_ {}
 This is a list of the subcommands collected, in order. More...
 
std::set< App * > exclude_subcommands_ {}
 this is a list of subcommands that are exclusionary to this one More...
 
std::set< Option * > exclude_options_ {}
 
std::set< App * > need_subcommands_ {}
 
std::set< Option * > need_options_ {}
 
void clear ()
 Reset the parsed data. More...
 
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. More...
 
void parse_from_stream (std::istream &input)
 
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. More...
 
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. More...
 

Subcommands

enum  startup_mode : char { startup_mode::stable, startup_mode::enabled, startup_mode::disabled }
 Storage for subcommand list. More...
 
std::vector< App_psubcommands_ {}
 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...
 
Appparent_ {nullptr}
 A pointer to the parent if this is a subcommand. More...
 
std::string group_ {"Subcommands"}
 The group membership INHERITABLE. More...
 
std::vector< std::stringaliases_ {}
 Alias names for the subcommand. More...
 
Appadd_subcommand (std::string subcommand_name="", std::string subcommand_description="")
 Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag. More...
 
Appadd_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...
 
Appget_subcommand (const App *subcom) const
 
CLI11_NODISCARD Appget_subcommand (std::string subcom) const
 Check to see if a subcommand is part of this command (text version) More...
 
CLI11_NODISCARD Appget_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 Appget_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
 
Appgroup (std::string group_name)
 Changes the group membership. More...
 
Apprequire_subcommand ()
 The argumentless form of require subcommand requires 1 or more subcommands. More...
 
Apprequire_subcommand (int value)
 
Apprequire_subcommand (std::size_t min, std::size_t max)
 
Apprequire_option ()
 The argumentless form of require option requires 1 or more options be used. More...
 
Apprequire_option (int value)
 
Apprequire_option (std::size_t min, std::size_t max)
 
Appfallthrough (bool value=true)
 
 operator bool () const
 

Adding options

Optionadd_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>
Optionadd_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>
Optionadd_option_no_stream (std::string option_name, AssignTo &variable, std::string option_description="")
 Add option for assigning to a variable. More...
 
template<typename ArgType >
Optionadd_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...
 
Optionadd_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>
Optionadd_option (std::string option_name, T &option_description)
 Add option with description but with no variable assignment or callback. More...
 
Optionset_help_flag (std::string flag_name="", const std::string &help_description="")
 Set a help flag, replace the existing one if present. More...
 
Optionset_help_all_flag (std::string help_name="", const std::string &help_description="")
 Set a help all flag, replaced the existing one if present. More...
 
Optionset_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...
 
Optionset_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...
 
Optionadd_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>
Optionadd_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>
Optionadd_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>
Optionadd_flag (std::string flag_name, std::vector< T > &flag_results, std::string flag_description="")
 Vector version to capture multiple flags. More...
 
Optionadd_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...
 
Optionadd_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...
 
Optionset_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...
 

Detailed Description

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.

Member Typedef Documentation

using pxr_CLI::CLI::App::missing_t = std::vector<std::pair<detail::Classifier, std::string>>
protected

Pair of classifier, string for missing options. (extra detail is removed on returning from parse)

This is faster and cleaner than storing just a list of strings and reparsing. This may contain the – separator.

Definition at line 5695 of file CLI11.h.

Member Enumeration Documentation

enum pxr_CLI::CLI::App::startup_mode : char
strongprotected

Storage for subcommand list.

Enumerator
stable 
enabled 
disabled 

Definition at line 5750 of file CLI11.h.

Constructor & Destructor Documentation

CLI11_INLINE pxr_CLI::CLI::App::App ( std::string  app_description,
std::string  app_name,
App parent 
)
protected

Special private constructor for subcommand.

OptionDefaults

Definition at line 6922 of file CLI11.h.

pxr_CLI::CLI::App::App ( std::string  app_description = "",
std::string  app_name = "" 
)
inlineexplicit

Create a new program. Pass in the same arguments as main(), along with a help string.

Definition at line 5812 of file CLI11.h.

pxr_CLI::CLI::App::App ( const App )
delete

Create a new program. Pass in the same arguments as main(), along with a help string.

virtual pxr_CLI::CLI::App::~App ( )
virtualdefault

virtual destructor

Member Function Documentation

CLI11_NODISCARD CLI11_INLINE const std::string & pxr_CLI::CLI::App::_compare_subcommand_names ( const App subcom,
const App base 
) const
protected

Helper function to run through all possible comparisons of subcommand names to check there is no overlap.

Definition at line 8752 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_configure ( )
protected

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 7793 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::size_t pxr_CLI::CLI::App::_count_remaining_positionals ( bool  required_only = false) const
protected

Count the required remaining positional arguments.

Definition at line 8359 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE App * pxr_CLI::CLI::App::_find_subcommand ( const std::string subc_name,
bool  ignore_disabled,
bool  ignore_used 
) const
protectednoexcept

Locate a subcommand by name with two conditions, should disabled subcommands be ignored, and should used subcommands be ignored

Definition at line 8506 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::_get_fallthrough_parent ( )
protected

Get the appropriate parent to fallthrough to which is the first one that has a name or the main app.

Definition at line 8741 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE bool pxr_CLI::CLI::App::_has_remaining_positionals ( ) const
protected

Count the required remaining positional arguments.

Definition at line 8371 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_move_option ( Option opt,
App app 
)

function that could be used by subclasses of App to shift options around into subcommands

Definition at line 8819 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_move_to_missing ( detail::Classifier  val_type,
const std::string val 
)
protected

Helper function to place extra values in the most appropriate position.

Definition at line 8803 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_parse ( std::vector< std::string > &  args)
protected

Internal parse function.

Definition at line 8175 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_parse ( std::vector< std::string > &&  args)
protected

Internal parse function.

Definition at line 8203 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::_parse_arg ( std::vector< std::string > &  args,
detail::Classifier  current_type 
)
protected

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

if we require a separator add it here

Definition at line 8552 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_parse_config ( const std::vector< ConfigItem > &  args)
protected

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 8230 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::_parse_positional ( std::vector< std::string > &  args,
bool  haltOnSubcommand 
)
protected

Parse a positional, go up the tree to check

Parameters
haltOnSubcommandif set to true the operation will not process subcommands merely return false Return true if the positional was used false otherwise

if we require a separator add it here

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 8381 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::_parse_single ( std::vector< std::string > &  args,
bool &  positional_only 
)
protected

Parse "one" argument (some may eat more than one), delegate to parent if fails, add to missing if missing from main return false if the parse has failed and needs to return to parent

Definition at line 8317 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::_parse_single_config ( const ConfigItem item,
std::size_t  level = 0 
)
protected

Fill in a single config option.

Definition at line 8237 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_parse_stream ( std::istream &  input)
protected

Internal function to parse a stream.

Definition at line 8219 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::_parse_subcommand ( std::vector< std::string > &  args)
protected

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 8524 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process ( )
protected

Process callbacks and such.

Definition at line 8116 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process_callbacks ( )
protected

Process callbacks. Runs on all subcommands.

Definition at line 7942 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process_config_file ( )
protected

Read and process a configuration file (main app only)

Definition at line 7878 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process_env ( )
protected

Get envname options if not yet passed. Runs on all subcommands.

Definition at line 7910 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process_extras ( )
protected

Throw an error if anything is left over and should not be.

Definition at line 8138 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process_extras ( std::vector< std::string > &  args)
protected

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 8152 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process_help_flags ( bool  trigger_help = false,
bool  trigger_all_help = false 
) const
protected

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 7966 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_process_requirements ( )
protected

Verify required options and cross requirements. Subcommands too (only if selected).

Definition at line 7988 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE detail::Classifier pxr_CLI::CLI::App::_recognize ( const std::string current,
bool  ignore_used_subcommands = true 
) const
protected

Selects a Classifier enum based on the type of the current argument.

Definition at line 7853 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_trigger_pre_parse ( std::size_t  remaining_args)
protected

Trigger the pre_parse callback if needed.

Definition at line 8723 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE bool pxr_CLI::CLI::App::_valid_subcommand ( const std::string current,
bool  ignore_used = true 
) const
protected

Check to see if a subcommand is valid. Give up immediately if subcommand max has been reached.

Definition at line 7840 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::_validate ( ) const
protected

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 7758 of file CLI11.h.

Option* pxr_CLI::CLI::App::add_flag ( std::string  flag_name)
inline

Add a flag with no description or variable assignment.

Definition at line 6123 of file CLI11.h.

template<typename T , enable_if_t< std::is_const< T >::value &&std::is_constructible< std::string, T >::value, detail::enabler > = detail::dummy>
Option* pxr_CLI::CLI::App::add_flag ( std::string  flag_name,
T &  flag_description 
)
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

Definition at line 6131 of file CLI11.h.

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* pxr_CLI::CLI::App::add_flag ( std::string  flag_name,
T &  flag_result,
std::string  flag_description = "" 
)
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

Parameters
flag_resultA variable holding the flag result

Definition at line 6141 of file CLI11.h.

template<typename T , enable_if_t<!std::is_assignable< std::function< void(std::int64_t)> &, T >::value, detail::enabler > = detail::dummy>
Option* pxr_CLI::CLI::App::add_flag ( std::string  flag_name,
std::vector< T > &  flag_results,
std::string  flag_description = "" 
)
inline

Vector version to capture multiple flags.

Parameters
flag_resultsA vector of values with the flag results

Definition at line 6156 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::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.

Parameters
functionA function to call, void(void)

Definition at line 7162 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::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.

Parameters
functionA function to call, void(int)

Definition at line 7178 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::add_option ( std::string  option_name,
callback_t  option_callback,
std::string  option_description = "",
bool  defaulted = false,
std::function< std::string()>  func = {} 
)

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 7030 of file CLI11.h.

template<typename AssignTo , typename ConvertTo = AssignTo, enable_if_t<!std::is_const< ConvertTo >::value, detail::enabler > = detail::dummy>
Option* pxr_CLI::CLI::App::add_option ( std::string  option_name,
AssignTo &  variable,
std::string  option_description = "" 
)
inline

Add option for assigning to a variable.

Parameters
variableThe variable to set

Definition at line 6026 of file CLI11.h.

Option* pxr_CLI::CLI::App::add_option ( std::string  option_name)
inline

Add option with no description or variable assignment.

Definition at line 6089 of file CLI11.h.

template<typename T , enable_if_t< std::is_const< T >::value &&std::is_constructible< std::string, T >::value, detail::enabler > = detail::dummy>
Option* pxr_CLI::CLI::App::add_option ( std::string  option_name,
T &  option_description 
)
inline

Add option with description but with no variable assignment or callback.

Definition at line 6097 of file CLI11.h.

template<typename ArgType >
Option* pxr_CLI::CLI::App::add_option_function ( std::string  option_name,
const std::function< void(const ArgType &)> &  func,
std::string  option_description = "" 
)
inline

Add option for a callback of a specific type.

Parameters
functhe callback to execute

Definition at line 6068 of file CLI11.h.

template<typename T = Option_group>
T* pxr_CLI::CLI::App::add_option_group ( std::string  group_name,
std::string  group_description = "" 
)
inline

creates an option group as part of the given app

Definition at line 6202 of file CLI11.h.

template<typename AssignTo , enable_if_t<!std::is_const< AssignTo >::value, detail::enabler > = detail::dummy>
Option* pxr_CLI::CLI::App::add_option_no_stream ( std::string  option_name,
AssignTo &  variable,
std::string  option_description = "" 
)
inline

Add option for assigning to a variable.

Parameters
variableThe variable to set

Definition at line 6050 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::add_subcommand ( std::string  subcommand_name = "",
std::string  subcommand_description = "" 
)

Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag.

Definition at line 7239 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::add_subcommand ( CLI::App_p  subcom)

Add a previously created app as a subcommand.

Definition at line 7256 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::alias ( std::string  app_name)

Set an alias for the app.

Definition at line 6972 of file CLI11.h.

App* pxr_CLI::CLI::App::allow_config_extras ( bool  allow = true)
inline

ignore extras in config files

Definition at line 5927 of file CLI11.h.

App* pxr_CLI::CLI::App::allow_config_extras ( config_extras_mode  mode)
inline

ignore extras in config files

Definition at line 5938 of file CLI11.h.

App* pxr_CLI::CLI::App::allow_extras ( bool  allow = true)
inline

Remove the error when extras are left over on the command line.

Definition at line 5866 of file CLI11.h.

App* pxr_CLI::CLI::App::allow_windows_style_options ( bool  value = true)
inline

Allow windows style options, such as /opt. First matching short or long name used. Subcommands inherit value.

Definition at line 5954 of file CLI11.h.

App* pxr_CLI::CLI::App::callback ( std::function< void()>  app_callback)
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 5829 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE bool pxr_CLI::CLI::App::check_name ( std::string  name_to_check) const

Check the name, case insensitive and underscore insensitive if set.

Definition at line 7671 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::clear ( void  )

Reset the parsed data.

Definition at line 7358 of file CLI11.h.

App* pxr_CLI::CLI::App::clear_aliases ( )
inline

clear all the aliases of the current App

Definition at line 6655 of file CLI11.h.

App* pxr_CLI::CLI::App::config_formatter ( std::shared_ptr< Config fmt)
inline

Set the config formatter.

Definition at line 5987 of file CLI11.h.

CLI11_NODISCARD std::string pxr_CLI::CLI::App::config_to_str ( bool  default_also = false,
bool  write_description = false 
) const
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. write_descriptions will print a description for the App and for each option.

Definition at line 6477 of file CLI11.h.

App* pxr_CLI::CLI::App::configurable ( bool  value = true)
inline

Specify that the subcommand can be triggered by a config file.

Definition at line 5966 of file CLI11.h.

CLI11_NODISCARD std::size_t pxr_CLI::CLI::App::count ( ) const
inline

No argument version of count counts the number of times this subcommand was passed in. The main app will return 1. Unnamed subcommands will also return 1 unless otherwise modified in a callback

Definition at line 6252 of file CLI11.h.

CLI11_NODISCARD std::size_t pxr_CLI::CLI::App::count ( std::string  option_name) const
inline

Counts the number of times the given option was passed.

Definition at line 6381 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::size_t pxr_CLI::CLI::App::count_all ( ) const

Get a count of all the arguments processed in options and subcommands, this excludes arguments which were treated as extras.

Definition at line 7344 of file CLI11.h.

App* pxr_CLI::CLI::App::description ( std::string  app_description)
inline

Set the description of the app.

Definition at line 6511 of file CLI11.h.

App* pxr_CLI::CLI::App::disabled ( bool  disable = true)
inline

Disable the subcommand or option group.

Definition at line 5878 of file CLI11.h.

App* pxr_CLI::CLI::App::disabled_by_default ( bool  disable = true)
inline

Set the subcommand to be disabled by default, so on clear(), at the start of each parse it is disabled.

Definition at line 5890 of file CLI11.h.

App* pxr_CLI::CLI::App::enabled_by_default ( bool  enable = true)
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 5901 of file CLI11.h.

App* pxr_CLI::CLI::App::excludes ( Option opt)
inline

Sets excluded options for the subcommand.

Definition at line 6407 of file CLI11.h.

App* pxr_CLI::CLI::App::excludes ( App app)
inline

Sets excluded subcommands for the subcommand.

Definition at line 6416 of file CLI11.h.

CLI11_INLINE int pxr_CLI::CLI::App::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.

Avoid printing anything if this is a CLI::RuntimeError

Definition at line 7463 of file CLI11.h.

void pxr_CLI::CLI::App::failure_message ( std::function< std::string(const App *, const Error &e)>  function)
inline

Provide a function to print a help message. The function gets access to the App pointer and error.

Definition at line 6369 of file CLI11.h.

App* pxr_CLI::CLI::App::fallthrough ( bool  value = true)
inline

Stop subcommand fallthrough, so that parent commands cannot collect commands after subcommand. Default from parent, usually set on parent.

Definition at line 6324 of file CLI11.h.

App* pxr_CLI::CLI::App::final_callback ( std::function< void()>  app_callback)
inline

Set a callback for execution when all parsing and processing has completed aliased as callback

Definition at line 5840 of file CLI11.h.

App* pxr_CLI::CLI::App::footer ( std::string  footer_string)
inline

Set footer.

Definition at line 6466 of file CLI11.h.

App* pxr_CLI::CLI::App::footer ( std::function< std::string()>  footer_function)
inline

Set footer.

Definition at line 6471 of file CLI11.h.

App* pxr_CLI::CLI::App::formatter ( std::shared_ptr< FormatterBase fmt)
inline

Set the help formatter.

Definition at line 5975 of file CLI11.h.

App* pxr_CLI::CLI::App::formatter_fn ( std::function< std::string(const App *, std::string, AppFormatMode)>  fmt)
inline

Set the help formatter.

Definition at line 5981 of file CLI11.h.

CLI11_NODISCARD const std::vector<std::string>& pxr_CLI::CLI::App::get_aliases ( ) const
inline

Get the aliases of the current app.

Definition at line 6652 of file CLI11.h.

CLI11_NODISCARD config_extras_mode pxr_CLI::CLI::App::get_allow_config_extras ( ) const
inline

Get the status of allow extras.

Definition at line 6619 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_allow_extras ( ) const
inline

Get the status of allow extras.

Definition at line 6594 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_allow_windows_style_options ( ) const
inline

Check the status of the allow windows style options.

Definition at line 6562 of file CLI11.h.

CLI11_NODISCARD std::shared_ptr<Config> pxr_CLI::CLI::App::get_config_formatter ( ) const
inline

Access the config formatter.

Definition at line 6495 of file CLI11.h.

CLI11_NODISCARD std::shared_ptr<ConfigBase> pxr_CLI::CLI::App::get_config_formatter_base ( ) const
inline

Access the config formatter as a configBase pointer.

Definition at line 6498 of file CLI11.h.

Option* pxr_CLI::CLI::App::get_config_ptr ( )
inline

Get a pointer to the config option.

Definition at line 6631 of file CLI11.h.

CLI11_NODISCARD const Option* pxr_CLI::CLI::App::get_config_ptr ( ) const
inline

Get a pointer to the config option. (const)

Definition at line 6634 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_configurable ( ) const
inline

Check the status of the allow windows style options.

Definition at line 6568 of file CLI11.h.

CLI11_NODISCARD std::string pxr_CLI::CLI::App::get_description ( ) const
inline

Get the app or subcommand description.

Definition at line 6508 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_disabled ( ) const
inline

Get the status of disabled.

Definition at line 6600 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_disabled_by_default ( ) const
inline

Get the status of disabled by default.

Definition at line 6609 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::string pxr_CLI::CLI::App::get_display_name ( bool  with_aliases = false) const

Get a display name for an app.

Definition at line 7655 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_enabled_by_default ( ) const
inline

Get the status of disabled by default.

Definition at line 6612 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_fallthrough ( ) const
inline

Check the status of fallthrough.

Definition at line 6559 of file CLI11.h.

CLI11_NODISCARD std::string pxr_CLI::CLI::App::get_footer ( ) const
inline

Generate and return the footer.

Definition at line 6574 of file CLI11.h.

CLI11_NODISCARD std::shared_ptr<FormatterBase> pxr_CLI::CLI::App::get_formatter ( ) const
inline

Access the formatter.

Definition at line 6492 of file CLI11.h.

CLI11_NODISCARD const std::string& pxr_CLI::CLI::App::get_group ( ) const
inline

Get the group of this subcommand.

Definition at line 6571 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::vector< std::string > pxr_CLI::CLI::App::get_groups ( ) const

Get the groups available directly from this option (in order)

Definition at line 7699 of file CLI11.h.

CLI11_NODISCARD const Option* pxr_CLI::CLI::App::get_help_all_ptr ( ) const
inline

Get a pointer to the help all flag. (const)

Definition at line 6628 of file CLI11.h.

Option* pxr_CLI::CLI::App::get_help_ptr ( )
inline

Get a pointer to the help flag.

Definition at line 6622 of file CLI11.h.

CLI11_NODISCARD const Option* pxr_CLI::CLI::App::get_help_ptr ( ) const
inline

Get a pointer to the help flag. (const)

Definition at line 6625 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_ignore_case ( ) const
inline

Check the status of ignore_case.

Definition at line 6553 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_ignore_underscore ( ) const
inline

Check the status of ignore_underscore.

Definition at line 6556 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_immediate_callback ( ) const
inline

Get the status of disabled.

Definition at line 6606 of file CLI11.h.

CLI11_NODISCARD const std::string& pxr_CLI::CLI::App::get_name ( ) const
inline

Get the name of the current app.

Definition at line 6649 of file CLI11.h.

CLI11_NODISCARD const Option* pxr_CLI::CLI::App::get_option ( std::string  option_name) const
inline

Get an option by name.

Definition at line 6529 of file CLI11.h.

Option* pxr_CLI::CLI::App::get_option ( std::string  option_name)
inline

Get an option by name (non-const version)

Definition at line 6538 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE CLI::App * pxr_CLI::CLI::App::get_option_group ( std::string  group_name) const

Check to see if an option group is part of this App.

Definition at line 7335 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::get_option_no_throw ( std::string  option_name)
noexcept

Get an option by name (noexcept non-const version)

Definition at line 7619 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE const Option * pxr_CLI::CLI::App::get_option_no_throw ( std::string  option_name) const
noexcept

Get an option by name (noexcept const version)

Definition at line 7637 of file CLI11.h.

CLI11_INLINE std::vector< const Option * > pxr_CLI::CLI::App::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.

Definition at line 7590 of file CLI11.h.

CLI11_INLINE std::vector< Option * > pxr_CLI::CLI::App::get_options ( const std::function< bool(Option *)>  filter = {})

Non-const version of the above.

Definition at line 7605 of file CLI11.h.

App* pxr_CLI::CLI::App::get_parent ( )
inline

Get the parent of this subcommand (or nullptr if main app)

Definition at line 6643 of file CLI11.h.

CLI11_NODISCARD const App* pxr_CLI::CLI::App::get_parent ( ) const
inline

Get the parent of this subcommand (or nullptr if main app) (const version)

Definition at line 6646 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_positionals_at_end ( ) const
inline

Check the status of the allow windows style options.

Definition at line 6565 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_prefix_command ( ) const
inline

Get the prefix command status.

Definition at line 6591 of file CLI11.h.

CLI11_NODISCARD std::size_t pxr_CLI::CLI::App::get_require_option_max ( ) const
inline

Get the required max option value.

Definition at line 6588 of file CLI11.h.

CLI11_NODISCARD std::size_t pxr_CLI::CLI::App::get_require_option_min ( ) const
inline

Get the required min option value.

Definition at line 6585 of file CLI11.h.

CLI11_NODISCARD std::size_t pxr_CLI::CLI::App::get_require_subcommand_max ( ) const
inline

Get the required max subcommand value.

Definition at line 6582 of file CLI11.h.

CLI11_NODISCARD std::size_t pxr_CLI::CLI::App::get_require_subcommand_min ( ) const
inline

Get the required min subcommand value.

Definition at line 6579 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_required ( ) const
inline

Get the status of required.

Definition at line 6597 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_silent ( ) const
inline

Get the status of silence.

Definition at line 6603 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::get_subcommand ( const App subcom) const

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 7285 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE App * pxr_CLI::CLI::App::get_subcommand ( std::string  subcom) const

Check to see if a subcommand is part of this command (text version)

Definition at line 7294 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE App * pxr_CLI::CLI::App::get_subcommand ( int  index = 0) const

Get a pointer to subcommand by index.

Definition at line 7301 of file CLI11.h.

CLI11_INLINE CLI::App_p pxr_CLI::CLI::App::get_subcommand_ptr ( App subcom) const

Check to see if a subcommand is part of this command and get a shared_ptr to it.

Definition at line 7310 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE CLI::App_p pxr_CLI::CLI::App::get_subcommand_ptr ( std::string  subcom) const

Check to see if a subcommand is part of this command (text version)

Definition at line 7319 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE CLI::App_p pxr_CLI::CLI::App::get_subcommand_ptr ( int  index = 0) const

Get an owning pointer to subcommand by index.

Definition at line 7326 of file CLI11.h.

CLI11_NODISCARD std::vector<App *> pxr_CLI::CLI::App::get_subcommands ( ) const
inline

Get a subcommand pointer list to the currently selected subcommands (after parsing by default, in command line order; use parsed = false to get the original definition list.)

Definition at line 6385 of file CLI11.h.

CLI11_INLINE std::vector< const App * > pxr_CLI::CLI::App::get_subcommands ( const std::function< bool(const App *)> &  filter) const

Get a filtered subcommand pointer list from the original definition list. An empty function will provide all subcommands (const)

Definition at line 7492 of file CLI11.h.

CLI11_INLINE std::vector< App * > pxr_CLI::CLI::App::get_subcommands ( const std::function< bool(App *)> &  filter)

Get a filtered subcommand pointer list from the original definition list. An empty function will provide all subcommands

Definition at line 7507 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_validate_optional_arguments ( ) const
inline

Get the status of validating optional vector arguments.

Definition at line 6616 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::get_validate_positionals ( ) const
inline

Get the status of validating positionals.

Definition at line 6614 of file CLI11.h.

Option* pxr_CLI::CLI::App::get_version_ptr ( )
inline

Get a pointer to the version option.

Definition at line 6637 of file CLI11.h.

CLI11_NODISCARD const Option* pxr_CLI::CLI::App::get_version_ptr ( ) const
inline

Get a pointer to the version option. (const)

Definition at line 6640 of file CLI11.h.

bool pxr_CLI::CLI::App::got_subcommand ( const App subcom) const
inline

Check to see if given subcommand was selected.

Definition at line 6396 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::got_subcommand ( std::string  subcommand_name) const
inline

Check with name instead of pointer to see if subcommand was selected.

Definition at line 6402 of file CLI11.h.

App* pxr_CLI::CLI::App::group ( std::string  group_name)
inline

Changes the group membership.

Definition at line 6259 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::string pxr_CLI::CLI::App::help ( std::string  prev = "",
AppFormatMode  mode = AppFormatMode::Normal 
) const

Makes a help message, using the currently configured formatter Will only do one subcommand at a time

Definition at line 7559 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::ignore_case ( bool  value = true)

Ignore case. Subcommands inherit value.

Definition at line 7002 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::ignore_underscore ( bool  value = true)

Ignore underscore. Subcommands inherit value.

Definition at line 7016 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::immediate_callback ( bool  immediate = true)

Set the subcommand callback to be executed immediately on subcommand completion.

Definition at line 6990 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::increment_parsed ( )
protected

Internal function to recursively increment the parsed counter on the current app as well unnamed subcommands.

Definition at line 8167 of file CLI11.h.

CLI11_INLINE App * pxr_CLI::CLI::App::name ( std::string  app_name = "")

Set a name for the app (empty will use parser to set the name)

Definition at line 6955 of file CLI11.h.

App* pxr_CLI::CLI::App::needs ( Option opt)
inline

Counts the number of times the given option was passed.

Definition at line 6431 of file CLI11.h.

App* pxr_CLI::CLI::App::needs ( App app)
inline

Counts the number of times the given option was passed.

Definition at line 6439 of file CLI11.h.

pxr_CLI::CLI::App::operator bool ( ) const
inlineexplicit

Check to see if this subcommand was parsed, true only if received on command line. This allows the subcommand to be directly checked.

Definition at line 6331 of file CLI11.h.

App& pxr_CLI::CLI::App::operator= ( const App )
delete

Create a new program. Pass in the same arguments as main(), along with a help string.

const Option* pxr_CLI::CLI::App::operator[] ( const std::string option_name) const
inline

Shortcut bracket operator for getting a pointer to an option.

Definition at line 6547 of file CLI11.h.

const Option* pxr_CLI::CLI::App::operator[] ( const char *  option_name) const
inline

Shortcut bracket operator for getting a pointer to an option.

Definition at line 6550 of file CLI11.h.

OptionDefaults* pxr_CLI::CLI::App::option_defaults ( )
inline

Get the OptionDefault object, to set option defaults.

Definition at line 5996 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::parse ( int  argc,
const char *const *  argv 
)

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 7373 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::parse ( std::string  commandline,
bool  program_name_included = false 
)

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 7387 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::parse ( std::vector< std::string > &  args)

The real work is done here. Expects a reversed vector. Changes the vector to the remaining options.

Definition at line 7414 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::parse ( std::vector< std::string > &&  args)

The real work is done here. Expects a reversed vector.

Definition at line 7433 of file CLI11.h.

App* pxr_CLI::CLI::App::parse_complete_callback ( std::function< void()>  pc_callback)
inline

Set a callback to execute when parsing has completed for the app

Definition at line 5847 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::parse_from_stream ( std::istream &  input)

Pair of classifier, string for missing options. (extra detail is removed on returning from parse)

This is faster and cleaner than storing just a list of strings and reparsing. This may contain the – separator.

Definition at line 7452 of file CLI11.h.

CLI11_NODISCARD const std::vector<Option *>& pxr_CLI::CLI::App::parse_order ( ) const
inline

This gets a vector of pointers with the original parse order.

Definition at line 6670 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::App::parsed ( ) const
inline

Check to see if this subcommand was parsed, true only if received on command line.

Definition at line 5993 of file CLI11.h.

App* pxr_CLI::CLI::App::positionals_at_end ( bool  value = true)
inline

Specify that the positional arguments are only at the end of the sequence.

Definition at line 5960 of file CLI11.h.

virtual void pxr_CLI::CLI::App::pre_callback ( )
inlinevirtual

This allows subclasses to inject code before callbacks but after parse.

This does not run if any errors or help is thrown.

Definition at line 6340 of file CLI11.h.

App* pxr_CLI::CLI::App::prefix_command ( bool  allow = true)
inline

Do not parse anything after the first unrecognized option and return.

Definition at line 5944 of file CLI11.h.

App* pxr_CLI::CLI::App::preparse_callback ( std::function< void(std::size_t)>  pp_callback)
inline

Set a callback to execute prior to parsing.

Definition at line 5854 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::vector< std::string > pxr_CLI::CLI::App::remaining ( bool  recurse = false) const

This returns the missing options from the current subcommand.

Definition at line 7712 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::vector< std::string > pxr_CLI::CLI::App::remaining_for_passthrough ( bool  recurse = false) const

This returns the missing options in a form ready for processing by another command line program.

Definition at line 7738 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::size_t pxr_CLI::CLI::App::remaining_size ( bool  recurse = false) const

This returns the number of remaining options, minus the – separator.

Definition at line 7744 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::remove_excludes ( Option opt)

Removes an option from the excludes list of this subcommand.

Definition at line 7521 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::remove_excludes ( App app)

Removes a subcommand from the excludes list of this subcommand.

Definition at line 7530 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::remove_needs ( Option opt)

Removes an option from the needs list of this subcommand.

Definition at line 7541 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::remove_needs ( App app)

Removes a subcommand from the needs list of this subcommand.

Definition at line 7550 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::remove_option ( Option opt)

Removes an option from the App. Takes an option pointer. Returns true if found and removed.

Definition at line 7218 of file CLI11.h.

CLI11_INLINE bool pxr_CLI::CLI::App::remove_subcommand ( App subcom)

Removes a subcommand from the App. Takes a subcommand pointer. Returns true if found and removed.

Definition at line 7269 of file CLI11.h.

App* pxr_CLI::CLI::App::require_option ( )
inline

The argumentless form of require option requires 1 or more options be used.

Definition at line 6294 of file CLI11.h.

App* pxr_CLI::CLI::App::require_option ( int  value)
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).

Definition at line 6303 of file CLI11.h.

App* pxr_CLI::CLI::App::require_option ( std::size_t  min,
std::size_t  max 
)
inline

Explicitly control the number of options required. Setting 0 for the max means unlimited number allowed. Max number inheritable.

Definition at line 6316 of file CLI11.h.

App* pxr_CLI::CLI::App::require_subcommand ( )
inline

The argumentless form of require subcommand requires 1 or more subcommands.

Definition at line 6265 of file CLI11.h.

App* pxr_CLI::CLI::App::require_subcommand ( int  value)
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.

Definition at line 6274 of file CLI11.h.

App* pxr_CLI::CLI::App::require_subcommand ( std::size_t  min,
std::size_t  max 
)
inline

Explicitly control the number of subcommands required. Setting 0 for the max means unlimited number allowed. Max number inheritable.

Definition at line 6287 of file CLI11.h.

App* pxr_CLI::CLI::App::required ( bool  require = true)
inline

Remove the error when extras are left over on the command line.

Definition at line 5872 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::App::run_callback ( bool  final_mode = false,
bool  suppress_final_callback = false 
)
protected

Internal function to run (App) callback, bottom up.

Definition at line 7813 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::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.

Definition at line 7192 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::set_help_all_flag ( std::string  help_name = "",
const std::string help_description = "" 
)

Set a help all flag, replaced the existing one if present.

Definition at line 7086 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::set_help_flag ( std::string  flag_name = "",
const std::string help_description = "" 
)

Set a help flag, replace the existing one if present.

Definition at line 7070 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::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.

Definition at line 7103 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::App::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.

Definition at line 7121 of file CLI11.h.

App* pxr_CLI::CLI::App::silent ( bool  silence = true)
inline

silence the subcommand from showing up in the processed list

Definition at line 5884 of file CLI11.h.

App* pxr_CLI::CLI::App::validate_optional_arguments ( bool  validate = true)
inline

Set the subcommand to validate optional vector arguments before assigning.

Definition at line 5921 of file CLI11.h.

App* pxr_CLI::CLI::App::validate_positionals ( bool  validate = true)
inline

Set the subcommand to validate positional arguments before assigning.

Definition at line 5915 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::string pxr_CLI::CLI::App::version ( ) const

Displays a version string.

Definition at line 7573 of file CLI11.h.

Member Data Documentation

std::vector<std::string> pxr_CLI::CLI::App::aliases_ {}
protected

Alias names for the subcommand.

Definition at line 5790 of file CLI11.h.

config_extras_mode pxr_CLI::CLI::App::allow_config_extras_ {config_extras_mode::ignore}
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 5626 of file CLI11.h.

bool pxr_CLI::CLI::App::allow_extras_ {false}
protected

If true, allow extra arguments (ie, don't throw an error). INHERITABLE.

Definition at line 5622 of file CLI11.h.

bool pxr_CLI::CLI::App::allow_windows_style_options_
protected
Initial value:
{
false
}

Allow '/' for options for Windows like options. Defaults to true on Windows, false otherwise. INHERITABLE.

Definition at line 5740 of file CLI11.h.

std::shared_ptr<Config> pxr_CLI::CLI::App::config_formatter_ {new ConfigTOML()}
protected

This is the formatter for help printing. Default provided. INHERITABLE (same pointer)

Definition at line 5800 of file CLI11.h.

Option* pxr_CLI::CLI::App::config_ptr_ {nullptr}
protected

Pointer to the config option.

Definition at line 5797 of file CLI11.h.

bool pxr_CLI::CLI::App::configurable_ {false}
protected

if set to true the subcommand can be triggered via configuration files INHERITABLE

Definition at line 5756 of file CLI11.h.

startup_mode pxr_CLI::CLI::App::default_startup {startup_mode::stable}
protected

specify the startup mode for the app stable=no change, enabled= startup enabled, disabled=startup disabled

Definition at line 5753 of file CLI11.h.

std::string pxr_CLI::CLI::App::description_ {}
protected

Description of the current program/subcommand.

Definition at line 5619 of file CLI11.h.

bool pxr_CLI::CLI::App::disabled_ {false}
protected

If set to true the subcommand is disabled and cannot be used, ignored for main app.

Definition at line 5638 of file CLI11.h.

std::set<Option *> pxr_CLI::CLI::App::exclude_options_ {}
protected

This is a list of options which are exclusionary to this App, if the options were used this subcommand should not be

Definition at line 5713 of file CLI11.h.

std::set<App *> pxr_CLI::CLI::App::exclude_subcommands_ {}
protected

this is a list of subcommands that are exclusionary to this one

Definition at line 5709 of file CLI11.h.

std::function<std::string(const App *, const Error &e)> pxr_CLI::CLI::App::failure_message_ {FailureMessage::simple}
protected

The error message printing function INHERITABLE.

Definition at line 5689 of file CLI11.h.

bool pxr_CLI::CLI::App::fallthrough_ {false}
protected

Allow subcommand fallthrough, so that parent commands can collect commands after subcommand. INHERITABLE.

Definition at line 5737 of file CLI11.h.

std::function<void()> pxr_CLI::CLI::App::final_callback_ {}
protected

This is a function that runs when all processing has completed.

Definition at line 5654 of file CLI11.h.

std::string pxr_CLI::CLI::App::footer_ {}
protected

Footer to put after all options in the help output INHERITABLE.

Definition at line 5671 of file CLI11.h.

std::function<std::string()> pxr_CLI::CLI::App::footer_callback_ {}
protected

This is a function that generates a footer to put after all other options in help output.

Definition at line 5674 of file CLI11.h.

std::shared_ptr<FormatterBase> pxr_CLI::CLI::App::formatter_ {new Formatter()}
protected

This is the formatter for help printing. Default provided. INHERITABLE (same pointer)

Definition at line 5686 of file CLI11.h.

std::string pxr_CLI::CLI::App::group_ {"Subcommands"}
protected

The group membership INHERITABLE.

Definition at line 5787 of file CLI11.h.

bool pxr_CLI::CLI::App::has_automatic_name_ {false}
protected

If set to true the name was automatically generated from the command line vs a user set name.

Definition at line 5632 of file CLI11.h.

Option* pxr_CLI::CLI::App::help_all_ptr_ {nullptr}
protected

A pointer to the help all flag if there is one INHERITABLE.

Definition at line 5680 of file CLI11.h.

Option* pxr_CLI::CLI::App::help_ptr_ {nullptr}
protected

A pointer to the help flag if there is one INHERITABLE.

Definition at line 5677 of file CLI11.h.

bool pxr_CLI::CLI::App::ignore_case_ {false}
protected

If true, the program name is not case sensitive INHERITABLE.

Definition at line 5731 of file CLI11.h.

bool pxr_CLI::CLI::App::ignore_underscore_ {false}
protected

If true, the program should ignore underscores INHERITABLE.

Definition at line 5734 of file CLI11.h.

bool pxr_CLI::CLI::App::immediate_callback_ {false}
protected

Flag indicating that the callback for the subcommand should be executed immediately on parse completion which is before help or ini files are processed. INHERITABLE

Definition at line 5645 of file CLI11.h.

missing_t pxr_CLI::CLI::App::missing_ {}
protected

Pair of classifier, string for missing options. (extra detail is removed on returning from parse)

This is faster and cleaner than storing just a list of strings and reparsing. This may contain the – separator.

Definition at line 5700 of file CLI11.h.

std::string pxr_CLI::CLI::App::name_ {}
protected

Subcommand name or program name (from parser if name is empty)

Definition at line 5616 of file CLI11.h.

std::set<Option *> pxr_CLI::CLI::App::need_options_ {}
protected

This is a list of options which are required by this app, the list is not mutual, listed options do not need the subcommand not be

Definition at line 5721 of file CLI11.h.

std::set<App *> pxr_CLI::CLI::App::need_subcommands_ {}
protected

this is a list of subcommands or option groups that are required by this one, the list is not mutual, the listed subcommands do not require this one

Definition at line 5717 of file CLI11.h.

OptionDefaults pxr_CLI::CLI::App::option_defaults_ {}
protected

The default values for options, customizable and changeable INHERITABLE.

Definition at line 5661 of file CLI11.h.

std::vector<Option_p> pxr_CLI::CLI::App::options_ {}
protected

The list of options, stored locally.

Definition at line 5664 of file CLI11.h.

App* pxr_CLI::CLI::App::parent_ {nullptr}
protected

A pointer to the parent if this is a subcommand.

Definition at line 5784 of file CLI11.h.

std::function<void()> pxr_CLI::CLI::App::parse_complete_callback_ {}
protected

This is a function that runs when parsing has finished.

Definition at line 5651 of file CLI11.h.

std::vector<Option *> pxr_CLI::CLI::App::parse_order_ {}
protected

This is a list of pointers to options with the original parse order.

Definition at line 5703 of file CLI11.h.

std::uint32_t pxr_CLI::CLI::App::parsed_ {0U}
protected

Counts the number of times this command/subcommand was parsed.

Definition at line 5769 of file CLI11.h.

std::vector<App *> pxr_CLI::CLI::App::parsed_subcommands_ {}
protected

This is a list of the subcommands collected, in order.

Definition at line 5706 of file CLI11.h.

bool pxr_CLI::CLI::App::positionals_at_end_ {false}
protected

specify that positional arguments come at the end of the argument sequence not inheritable

Definition at line 5748 of file CLI11.h.

std::function<void(std::size_t)> pxr_CLI::CLI::App::pre_parse_callback_ {}
protected

This is a function that runs prior to the start of parsing.

Definition at line 5648 of file CLI11.h.

bool pxr_CLI::CLI::App::pre_parse_called_ {false}
protected

Flag indicating that the pre_parse_callback has been triggered.

Definition at line 5641 of file CLI11.h.

bool pxr_CLI::CLI::App::prefix_command_ {false}
protected

If true, return immediately on an unrecognized option (implies allow_extras) INHERITABLE.

Definition at line 5629 of file CLI11.h.

std::size_t pxr_CLI::CLI::App::require_option_max_ {0}
protected

Max number of options allowed. 0 is unlimited (not inheritable)

Definition at line 5781 of file CLI11.h.

std::size_t pxr_CLI::CLI::App::require_option_min_ {0}
protected

Minimum required options (not inheritable!)

Definition at line 5778 of file CLI11.h.

std::size_t pxr_CLI::CLI::App::require_subcommand_max_ {0}
protected

Max number of subcommands allowed (parsing stops after this number). 0 is unlimited INHERITABLE.

Definition at line 5775 of file CLI11.h.

std::size_t pxr_CLI::CLI::App::require_subcommand_min_ {0}
protected

Minimum required subcommands (not inheritable!)

Definition at line 5772 of file CLI11.h.

bool pxr_CLI::CLI::App::required_ {false}
protected

If set to true the subcommand is required to be processed and used, ignored for main app.

Definition at line 5635 of file CLI11.h.

bool pxr_CLI::CLI::App::silent_ {false}
protected

indicator that the subcommand is silent and won't show up in subcommands list This is potentially useful as a modifier subcommand

Definition at line 5766 of file CLI11.h.

std::vector<App_p> pxr_CLI::CLI::App::subcommands_ {}
protected

Storage for subcommand list.

Definition at line 5728 of file CLI11.h.

bool pxr_CLI::CLI::App::validate_optional_arguments_ {false}
protected

If set to true optional vector arguments are validated before assigning INHERITABLE.

Definition at line 5762 of file CLI11.h.

bool pxr_CLI::CLI::App::validate_positionals_ {false}
protected

If set to true positional options are validated before assigning INHERITABLE.

Definition at line 5759 of file CLI11.h.

Option* pxr_CLI::CLI::App::version_ptr_ {nullptr}
protected

A pointer to a version flag if there is one.

Definition at line 5683 of file CLI11.h.


The documentation for this class was generated from the following file: