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

#include <CLI11.h>

+ Inheritance diagram for pxr_CLI::CLI::Option:

Public Member Functions

Basic
 Option (const Option &)=delete
 Count the total number of times an option was passed. More...
 
Optionoperator= (const Option &)=delete
 Count the total number of times an option was passed. More...
 
CLI11_NODISCARD std::size_t count () const
 Count the total number of times an option was passed. More...
 
CLI11_NODISCARD bool empty () const
 True if the option was not passed. More...
 
 operator bool () const
 This bool operator returns true if any arguments were passed or the option callback is forced. More...
 
void clear ()
 Clear the parsed results (mostly for testing) More...
 
Setting options
Optionexpected (int value)
 Set the number of expected arguments. More...
 
Optionexpected (int value_min, int value_max)
 Set the range of expected arguments. More...
 
Optionallow_extra_args (bool value=true)
 
CLI11_NODISCARD bool get_allow_extra_args () const
 Get the current value of allow extra args. More...
 
Optiontrigger_on_parse (bool value=true)
 Set the value of trigger_on_parse which specifies that the option callback should be triggered on every parse. More...
 
CLI11_NODISCARD bool get_trigger_on_parse () const
 The status of trigger on parse. More...
 
Optionforce_callback (bool value=true)
 Set the value of force_callback. More...
 
CLI11_NODISCARD bool get_force_callback () const
 The status of force_callback. More...
 
Optionrun_callback_for_default (bool value=true)
 
CLI11_NODISCARD bool get_run_callback_for_default () const
 Get the current value of run_callback_for_default. More...
 
Optioncheck (Validator validator, const std::string &validator_name="")
 Adds a Validator with a built in type name. More...
 
Optioncheck (std::function< std::string(const std::string &)> Validator, std::string Validator_description="", std::string Validator_name="")
 Adds a Validator. Takes a const string& and returns an error message (empty if conversion/check is okay). More...
 
Optiontransform (Validator Validator, const std::string &Validator_name="")
 Adds a transforming Validator with a built in type name. More...
 
Optiontransform (const std::function< std::string(std::string)> &func, std::string transform_description="", std::string transform_name="")
 Adds a Validator-like function that can change result. More...
 
Optioneach (const std::function< void(std::string)> &func)
 Adds a user supplied function to run on each item passed in (communicate though lambda capture) More...
 
Validatorget_validator (const std::string &Validator_name="")
 Get a named Validator. More...
 
Validatorget_validator (int index)
 Get a Validator by index NOTE: this may not be the order of definition. More...
 
Optionneeds (Option *opt)
 Sets required options. More...
 
template<typename T = App>
Optionneeds (std::string opt_name)
 Can find a string if needed. More...
 
template<typename A , typename B , typename... ARG>
Optionneeds (A opt, B opt1, ARG...args)
 Any number supported, any mix of string and Opt. More...
 
bool remove_needs (Option *opt)
 Remove needs link from an option. Returns true if the option really was in the needs list. More...
 
Optionexcludes (Option *opt)
 Sets excluded options. More...
 
template<typename T = App>
Optionexcludes (std::string opt_name)
 Can find a string if needed. More...
 
template<typename A , typename B , typename... ARG>
Optionexcludes (A opt, B opt1, ARG...args)
 Any number supported, any mix of string and Opt. More...
 
bool remove_excludes (Option *opt)
 Remove needs link from an option. Returns true if the option really was in the needs list. More...
 
Optionenvname (std::string name)
 Sets environment variable to read if no option given. More...
 
template<typename T = App>
Optionignore_case (bool value=true)
 
template<typename T = App>
Optionignore_underscore (bool value=true)
 
Optionmulti_option_policy (MultiOptionPolicy value=MultiOptionPolicy::Throw)
 Take the last argument if given multiple times (or another policy) More...
 
Optiondisable_flag_override (bool value=true)
 Disable flag overrides values, e.g. –flag=is not allowed. More...
 
Accessors
CLI11_NODISCARD int get_type_size () const
 The number of arguments the option expects. More...
 
CLI11_NODISCARD int get_type_size_min () const
 The minimum number of arguments the option expects. More...
 
CLI11_NODISCARD int get_type_size_max () const
 The maximum number of arguments the option expects. More...
 
CLI11_NODISCARD bool get_inject_separator () const
 Return the inject_separator flag. More...
 
CLI11_NODISCARD std::string get_envname () const
 The environment variable associated to this value. More...
 
CLI11_NODISCARD std::set
< Option * > 
get_needs () const
 The set of options needed. More...
 
CLI11_NODISCARD std::set
< Option * > 
get_excludes () const
 The set of options excluded. More...
 
CLI11_NODISCARD std::string get_default_str () const
 The default value (for help printing) More...
 
CLI11_NODISCARD callback_t get_callback () const
 Get the callback function. More...
 
CLI11_NODISCARD const
std::vector< std::string > & 
get_lnames () const
 Get the long names. More...
 
CLI11_NODISCARD const
std::vector< std::string > & 
get_snames () const
 Get the short names. More...
 
CLI11_NODISCARD const
std::vector< std::string > & 
get_fnames () const
 Get the flag names with specified default values. More...
 
CLI11_NODISCARD const std::stringget_single_name () const
 Get a single name for the option, first of lname, pname, sname, envname. More...
 
CLI11_NODISCARD int get_expected () const
 The number of times the option expects to be included. More...
 
CLI11_NODISCARD int get_expected_min () const
 The number of times the option expects to be included. More...
 
CLI11_NODISCARD int get_expected_max () const
 The max number of times the option expects to be included. More...
 
CLI11_NODISCARD int get_items_expected_min () const
 The total min number of expected string values to be used. More...
 
CLI11_NODISCARD int get_items_expected_max () const
 Get the maximum number of items expected to be returned and used for the callback. More...
 
CLI11_NODISCARD int get_items_expected () const
 The total min number of expected string values to be used. More...
 
CLI11_NODISCARD bool get_positional () const
 True if the argument can be given directly. More...
 
CLI11_NODISCARD bool nonpositional () const
 True if option has at least one non-positional name. More...
 
CLI11_NODISCARD bool has_description () const
 True if option has description. More...
 
CLI11_NODISCARD const std::stringget_description () const
 Get the description. More...
 
Optiondescription (std::string option_description)
 Set the description. More...
 
Optionoption_text (std::string text)
 The number of arguments the option expects. More...
 
CLI11_NODISCARD const std::stringget_option_text () const
 The number of arguments the option expects. More...
 
Help tools
CLI11_NODISCARD std::string get_name (bool positional=false, bool all_options=false) const
 Gets a comma separated list of names. Will include / prefer the positional name if positional is true. If all_options is false, pick just the most descriptive name to show. Use get_name(true) to get the positional name (replaces get_pname) More...
 
Parser tools
void run_callback ()
 Process the callback. More...
 
CLI11_NODISCARD const std::stringmatching_name (const Option &other) const
 If options share any of the same names, find it. More...
 
bool operator== (const Option &other) const
 If options share any of the same names, they are equal (not counting positional) More...
 
CLI11_NODISCARD bool check_name (const std::string &name) const
 Check a name. Requires "-" or "--" for short / long, supports positional name. More...
 
CLI11_NODISCARD bool check_sname (std::string name) const
 Requires "-" to be removed from string. More...
 
CLI11_NODISCARD bool check_lname (std::string name) const
 Requires "--" to be removed from string. More...
 
CLI11_NODISCARD bool check_fname (std::string name) const
 Requires "--" to be removed from string. More...
 
CLI11_NODISCARD std::string get_flag_value (const std::string &name, std::string input_value) const
 
Optionadd_result (std::string s)
 Puts a result at the end. More...
 
Optionadd_result (std::string s, int &results_added)
 Puts a result at the end and get a count of the number of arguments actually added. More...
 
Optionadd_result (std::vector< std::string > s)
 Puts a result at the end. More...
 
CLI11_NODISCARD const results_tresults () const
 Get the current complete results set. More...
 
CLI11_NODISCARD results_t reduced_results () const
 Get a copy of the results. More...
 
template<typename T >
void results (T &output) const
 Get the results as a specified type. More...
 
template<typename T >
CLI11_NODISCARDas () const
 Return the results as the specified type. More...
 
CLI11_NODISCARD bool get_callback_run () const
 See if the callback has been run already. More...
 
- Public Member Functions inherited from pxr_CLI::CLI::OptionBase< Option >
Optiongroup (const std::string &name)
 Changes the group membership. More...
 
Optionrequired (bool value=true)
 Set the option as required. More...
 
Optionmandatory (bool value=true)
 Support Plumbum term. More...
 
Optionalways_capture_default (bool value=true)
 
CLI11_NODISCARD const std::stringget_group () const
 Get the group of this option. More...
 
CLI11_NODISCARD bool get_required () const
 True if this is a required option. More...
 
CLI11_NODISCARD bool get_ignore_case () const
 The status of ignore case. More...
 
CLI11_NODISCARD bool get_ignore_underscore () const
 The status of ignore_underscore. More...
 
CLI11_NODISCARD bool get_configurable () const
 The status of configurable. More...
 
CLI11_NODISCARD bool get_disable_flag_override () const
 The status of configurable. More...
 
CLI11_NODISCARD char get_delimiter () const
 Get the current delimiter char. More...
 
CLI11_NODISCARD bool get_always_capture_default () const
 Return true if this will automatically capture the default value for help printing. More...
 
CLI11_NODISCARD MultiOptionPolicy get_multi_option_policy () const
 The status of the multi option policy. More...
 
Optiontake_last ()
 Set the multi option policy to take last. More...
 
Optiontake_first ()
 Set the multi option policy to take last. More...
 
Optiontake_all ()
 Set the multi option policy to take all arguments. More...
 
Optionjoin ()
 Set the multi option policy to join. More...
 
Optionjoin (char delim)
 Set the multi option policy to join with a specific delimiter. More...
 
Optionconfigurable (bool value=true)
 Allow in a configuration file. More...
 
Optiondelimiter (char value= '\0')
 Allow in a configuration file. More...
 

Protected Member Functions

 Option (std::string option_name, std::string option_description, callback_t callback, App *parent)
 Making an option by hand is not defined, it must be made by the App class. More...
 
- Protected Member Functions inherited from pxr_CLI::CLI::OptionBase< Option >
void copy_to (T *other) const
 Copy the contents to another similar class (one based on OptionBase) More...
 

Protected Attributes

Names
std::vector< std::stringsnames_ {}
 A list of the short names (-a) without the leading dashes. More...
 
std::vector< std::stringlnames_ {}
 A list of the long names (--long) without the leading dashes. More...
 
std::vector< std::pair
< std::string, std::string > > 
default_flag_values_ {}
 
std::vector< std::stringfnames_ {}
 a list of flag names with specified default values; More...
 
std::string pname_ {}
 A positional name. More...
 
std::string envname_ {}
 If given, check the environment for this option. More...
 
Help
std::string description_ {}
 The description for help strings. More...
 
std::string default_str_ {}
 A human readable default value, either manually set, captured, or captured by default. More...
 
std::string option_text_ {}
 If given, replace the text that describes the option type and usage in the help text. More...
 
std::function< std::string()> type_name_ {[]() { return std::string(); }}
 
std::function< std::string()> default_function_ {}
 Run this function to capture a default (ignore if empty) More...
 
Configuration
int type_size_max_ {1}
 
int type_size_min_ {1}
 The minimum number of arguments an option should be expecting. More...
 
int expected_min_ {1}
 The minimum number of expected values. More...
 
int expected_max_ {1}
 The maximum number of expected values. More...
 
std::vector< Validatorvalidators_ {}
 A list of Validators to run on each value parsed. More...
 
std::set< Option * > needs_ {}
 A list of options that are required with this option. More...
 
std::set< Option * > excludes_ {}
 A list of options that are excluded with this option. More...
 
Other
Appparent_ {nullptr}
 link back up to the parent App for fallthrough More...
 
callback_t callback_ {}
 Options store a callback to do all the work. More...
 
- Protected Attributes inherited from pxr_CLI::CLI::OptionBase< Option >
std::string group_
 The group membership. More...
 
bool required_
 True if this is a required option. More...
 
bool ignore_case_
 Ignore the case when matching (option, not value) More...
 
bool ignore_underscore_
 Ignore underscores when matching (option, not value) More...
 
bool configurable_
 Allow this option to be given in a configuration file. More...
 
bool disable_flag_override_
 Disable overriding flag values with '=value'. More...
 
char delimiter_
 Specify a delimiter character for vector arguments. More...
 
bool always_capture_default_
 Automatically capture default value. More...
 
MultiOptionPolicy multi_option_policy_
 Policy for handling multiple arguments beyond the expected Max. More...
 

Parsing results

enum  option_state : char { option_state::parsing = 0, option_state::validated = 2, option_state::reduced = 4, option_state::callback_run = 6 }
 enumeration for the option state machine More...
 
results_t results_ {}
 complete Results of parsing More...
 
results_t proc_results_ {}
 results after reduction More...
 
option_state current_option_state_ {option_state::parsing}
 Whether the callback has run (needed for INI parsing) More...
 
bool allow_extra_args_ {false}
 Specify that extra args beyond type_size_max should be allowed. More...
 
bool flag_like_ {false}
 Specify that the option should act like a flag vs regular option. More...
 
bool run_callback_for_default_ {false}
 Control option to run the callback to set the default. More...
 
bool inject_separator_ {false}
 flag indicating a separator needs to be injected after each argument call More...
 
bool trigger_on_result_ {false}
 flag indicating that the option should trigger the validation and callback chain on each result when loaded More...
 
bool force_callback_ {false}
 flag indicating that the option should force the callback regardless if any results present More...
 

Custom options

Optiontype_name_fn (std::function< std::string()> typefun)
 Set the type function to run when displayed on this option. More...
 
Optiontype_name (std::string typeval)
 Set a custom option typestring. More...
 
Optiontype_size (int option_type_size)
 Set a custom option size. More...
 
Optiontype_size (int option_type_size_min, int option_type_size_max)
 Set a custom option type size range. More...
 
void inject_separator (bool value=true)
 Set the value of the separator injection flag. More...
 
Optiondefault_function (const std::function< std::string()> &func)
 Set a capture function for the default. Mostly used by App. More...
 
Optioncapture_default_str ()
 Capture the default value from the original value (if it can be captured) More...
 
Optiondefault_str (std::string val)
 Set the default value string representation (does not change the contained value) More...
 
template<typename X >
Optiondefault_val (const X &val)
 
CLI11_NODISCARD std::string get_type_name () const
 Get the full typename for this option. More...
 

Detailed Description

Definition at line 4347 of file CLI11.h.

Member Enumeration Documentation

enum pxr_CLI::CLI::Option::option_state : char
strongprotected

enumeration for the option state machine

Enumerator
parsing 

The option is currently collecting parsed results.

validated 

the results have been validated

reduced 

a subset of results has been generated

callback_run 

the callback has been executed

Definition at line 4437 of file CLI11.h.

Constructor & Destructor Documentation

pxr_CLI::CLI::Option::Option ( std::string  option_name,
std::string  option_description,
callback_t  callback,
App parent 
)
inlineprotected

Making an option by hand is not defined, it must be made by the App class.

Definition at line 4460 of file CLI11.h.

pxr_CLI::CLI::Option::Option ( const Option )
delete

Count the total number of times an option was passed.

Member Function Documentation

CLI11_INLINE Option * pxr_CLI::CLI::Option::add_result ( std::string  s)

Puts a result at the end.

Definition at line 5305 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::add_result ( std::string  s,
int results_added 
)

Puts a result at the end and get a count of the number of arguments actually added.

Definition at line 5311 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::add_result ( std::vector< std::string s)

Puts a result at the end.

Definition at line 5317 of file CLI11.h.

Option* pxr_CLI::CLI::Option::allow_extra_args ( bool  value = true)
inline

Set the value of allow_extra_args which allows extra value arguments on the flag or option to be included with each instance

Definition at line 4499 of file CLI11.h.

template<typename T >
CLI11_NODISCARD T pxr_CLI::CLI::Option::as ( ) const
inline

Return the results as the specified type.

Definition at line 4820 of file CLI11.h.

Option* pxr_CLI::CLI::Option::capture_default_str ( )
inline

Capture the default value from the original value (if it can be captured)

Definition at line 4861 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::check ( Validator  validator,
const std::string validator_name = "" 
)

Adds a Validator with a built in type name.

Definition at line 4976 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::check ( std::function< std::string(const std::string &)>  Validator,
std::string  Validator_description = "",
std::string  Validator_name = "" 
)

Adds a Validator. Takes a const string& and returns an error message (empty if conversion/check is okay).

Definition at line 4984 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::check_fname ( std::string  name) const
inline

Requires "--" to be removed from string.

Definition at line 4762 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::check_lname ( std::string  name) const
inline

Requires "--" to be removed from string.

Definition at line 4757 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE bool pxr_CLI::CLI::Option::check_name ( const std::string name) const

Check a name. Requires "-" or "--" for short / long, supports positional name.

Definition at line 5233 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::check_sname ( std::string  name) const
inline

Requires "-" to be removed from string.

Definition at line 4752 of file CLI11.h.

void pxr_CLI::CLI::Option::clear ( void  )
inline

Clear the parsed results (mostly for testing)

Definition at line 4482 of file CLI11.h.

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

Count the total number of times an option was passed.

Definition at line 4473 of file CLI11.h.

Option* pxr_CLI::CLI::Option::default_function ( const std::function< std::string()> &  func)
inline

Set a capture function for the default. Mostly used by App.

Definition at line 4855 of file CLI11.h.

Option* pxr_CLI::CLI::Option::default_str ( std::string  val)
inline

Set the default value string representation (does not change the contained value)

Definition at line 4869 of file CLI11.h.

template<typename X >
Option* pxr_CLI::CLI::Option::default_val ( const X &  val)
inline

Set the default value and validate the results and run the callback if appropriate to set the value into the bound value only available for types that can be converted to a string

Definition at line 4876 of file CLI11.h.

Option* pxr_CLI::CLI::Option::description ( std::string  option_description)
inline

Set the description.

Definition at line 4711 of file CLI11.h.

Option* pxr_CLI::CLI::Option::disable_flag_override ( bool  value = true)
inline

Disable flag overrides values, e.g. –flag=is not allowed.

Definition at line 4624 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::each ( const std::function< void(std::string)> &  func)

Adds a user supplied function to run on each item passed in (communicate though lambda capture)

Definition at line 5014 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::empty ( void  ) const
inline

True if the option was not passed.

Definition at line 4476 of file CLI11.h.

Option* pxr_CLI::CLI::Option::envname ( std::string  name)
inline

Sets environment variable to read if no option given.

Definition at line 4603 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::excludes ( Option opt)

Sets excluded options.

Definition at line 5054 of file CLI11.h.

template<typename T = App>
Option* pxr_CLI::CLI::Option::excludes ( std::string  opt_name)
inline

Can find a string if needed.

Definition at line 4585 of file CLI11.h.

template<typename A , typename B , typename... ARG>
Option* pxr_CLI::CLI::Option::excludes ( opt,
opt1,
ARG...  args 
)
inline

Any number supported, any mix of string and Opt.

Definition at line 4594 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::expected ( int  value)

Set the number of expected arguments.

Definition at line 4936 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::expected ( int  value_min,
int  value_max 
)

Set the range of expected arguments.

Definition at line 4957 of file CLI11.h.

Option* pxr_CLI::CLI::Option::force_callback ( bool  value = true)
inline

Set the value of force_callback.

Definition at line 4514 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::get_allow_extra_args ( ) const
inline

Get the current value of allow extra args.

Definition at line 4504 of file CLI11.h.

CLI11_NODISCARD callback_t pxr_CLI::CLI::Option::get_callback ( ) const
inline

Get the callback function.

Definition at line 4656 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::get_callback_run ( ) const
inline

See if the callback has been run already.

Definition at line 4827 of file CLI11.h.

CLI11_NODISCARD std::string pxr_CLI::CLI::Option::get_default_str ( ) const
inline

The default value (for help printing)

Definition at line 4653 of file CLI11.h.

CLI11_NODISCARD const std::string& pxr_CLI::CLI::Option::get_description ( ) const
inline

Get the description.

Definition at line 4708 of file CLI11.h.

CLI11_NODISCARD std::string pxr_CLI::CLI::Option::get_envname ( ) const
inline

The environment variable associated to this value.

Definition at line 4644 of file CLI11.h.

CLI11_NODISCARD std::set<Option *> pxr_CLI::CLI::Option::get_excludes ( ) const
inline

The set of options excluded.

Definition at line 4650 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_expected ( ) const
inline

The number of times the option expects to be included.

Definition at line 4680 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_expected_max ( ) const
inline

The max number of times the option expects to be included.

Definition at line 4685 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_expected_min ( ) const
inline

The number of times the option expects to be included.

Definition at line 4683 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::string pxr_CLI::CLI::Option::get_flag_value ( const std::string name,
std::string  input_value 
) const

Get the value that goes for a flag, nominally gets the default value but allows for overrides if not disabled

Definition at line 5262 of file CLI11.h.

CLI11_NODISCARD const std::vector<std::string>& pxr_CLI::CLI::Option::get_fnames ( ) const
inline

Get the flag names with specified default values.

Definition at line 4665 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::get_force_callback ( ) const
inline

The status of force_callback.

Definition at line 4519 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::get_inject_separator ( ) const
inline

Return the inject_separator flag.

Definition at line 4641 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_items_expected ( ) const
inline

The total min number of expected string values to be used.

Definition at line 4696 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_items_expected_max ( ) const
inline

Get the maximum number of items expected to be returned and used for the callback.

Definition at line 4691 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_items_expected_min ( ) const
inline

The total min number of expected string values to be used.

Definition at line 4688 of file CLI11.h.

CLI11_NODISCARD const std::vector<std::string>& pxr_CLI::CLI::Option::get_lnames ( ) const
inline

Get the long names.

Definition at line 4659 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::string pxr_CLI::CLI::Option::get_name ( bool  positional = false,
bool  all_options = false 
) const

Gets a comma separated list of names. Will include / prefer the positional name if positional is true. If all_options is false, pick just the most descriptive name to show. Use get_name(true) to get the positional name (replaces get_pname)

The all list will never include a positional unless asked or that's the only name.

Parameters
positionalShow the positional name
all_optionsShow every option

Definition at line 5133 of file CLI11.h.

CLI11_NODISCARD std::set<Option *> pxr_CLI::CLI::Option::get_needs ( ) const
inline

The set of options needed.

Definition at line 4647 of file CLI11.h.

CLI11_NODISCARD const std::string& pxr_CLI::CLI::Option::get_option_text ( ) const
inline

The number of arguments the option expects.

Definition at line 4721 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::get_positional ( ) const
inline

True if the argument can be given directly.

Definition at line 4699 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::get_run_callback_for_default ( ) const
inline

Get the current value of run_callback_for_default.

Definition at line 4528 of file CLI11.h.

CLI11_NODISCARD const std::string& pxr_CLI::CLI::Option::get_single_name ( ) const
inline

Get a single name for the option, first of lname, pname, sname, envname.

Definition at line 4667 of file CLI11.h.

CLI11_NODISCARD const std::vector<std::string>& pxr_CLI::CLI::Option::get_snames ( ) const
inline

Get the short names.

Definition at line 4662 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::get_trigger_on_parse ( ) const
inline

The status of trigger on parse.

Definition at line 4511 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE std::string pxr_CLI::CLI::Option::get_type_name ( ) const

Get the full typename for this option.

Definition at line 5386 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_type_size ( ) const
inline

The number of arguments the option expects.

Definition at line 4633 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_type_size_max ( ) const
inline

The maximum number of arguments the option expects.

Definition at line 4638 of file CLI11.h.

CLI11_NODISCARD int pxr_CLI::CLI::Option::get_type_size_min ( ) const
inline

The minimum number of arguments the option expects.

Definition at line 4636 of file CLI11.h.

CLI11_INLINE Validator * pxr_CLI::CLI::Option::get_validator ( const std::string Validator_name = "")

Get a named Validator.

Definition at line 5024 of file CLI11.h.

CLI11_INLINE Validator * pxr_CLI::CLI::Option::get_validator ( int  index)

Get a Validator by index NOTE: this may not be the order of definition.

Definition at line 5036 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::has_description ( ) const
inline

True if option has description.

Definition at line 4705 of file CLI11.h.

template<typename T >
Option * pxr_CLI::CLI::Option::ignore_case ( bool  value = true)

Ignore case

The template hides the fact that we don't have the definition of App yet. You are never expected to add an argument to the template here.

Definition at line 5079 of file CLI11.h.

template<typename T >
Option * pxr_CLI::CLI::Option::ignore_underscore ( bool  value = true)

Ignore underscores in the option names

The template hides the fact that we don't have the definition of App yet. You are never expected to add an argument to the template here.

Definition at line 5099 of file CLI11.h.

void pxr_CLI::CLI::Option::inject_separator ( bool  value = true)
inline

Set the value of the separator injection flag.

Definition at line 4852 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE const std::string & pxr_CLI::CLI::Option::matching_name ( const Option other) const

If options share any of the same names, find it.

Definition at line 5212 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::multi_option_policy ( MultiOptionPolicy  value = MultiOptionPolicy::Throw)

Take the last argument if given multiple times (or another policy)

Definition at line 5120 of file CLI11.h.

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

Sets required options.

Definition at line 4556 of file CLI11.h.

template<typename T = App>
Option* pxr_CLI::CLI::Option::needs ( std::string  opt_name)
inline

Can find a string if needed.

Definition at line 4564 of file CLI11.h.

template<typename A , typename B , typename... ARG>
Option* pxr_CLI::CLI::Option::needs ( opt,
opt1,
ARG...  args 
)
inline

Any number supported, any mix of string and Opt.

Definition at line 4573 of file CLI11.h.

CLI11_NODISCARD bool pxr_CLI::CLI::Option::nonpositional ( ) const
inline

True if option has at least one non-positional name.

Definition at line 4702 of file CLI11.h.

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

This bool operator returns true if any arguments were passed or the option callback is forced.

Definition at line 4479 of file CLI11.h.

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

Count the total number of times an option was passed.

bool pxr_CLI::CLI::Option::operator== ( const Option other) const
inline

If options share any of the same names, they are equal (not counting positional)

Definition at line 4746 of file CLI11.h.

Option* pxr_CLI::CLI::Option::option_text ( std::string  text)
inline

The number of arguments the option expects.

Definition at line 4716 of file CLI11.h.

CLI11_NODISCARD CLI11_INLINE results_t pxr_CLI::CLI::Option::reduced_results ( ) const

Get a copy of the results.

Definition at line 5325 of file CLI11.h.

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

Remove needs link from an option. Returns true if the option really was in the needs list.

Definition at line 5069 of file CLI11.h.

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

Remove needs link from an option. Returns true if the option really was in the needs list.

Definition at line 5044 of file CLI11.h.

CLI11_NODISCARD const results_t& pxr_CLI::CLI::Option::results ( ) const
inline

Get the current complete results set.

Definition at line 4783 of file CLI11.h.

template<typename T >
void pxr_CLI::CLI::Option::results ( T &  output) const
inline

Get the results as a specified type.

Definition at line 4789 of file CLI11.h.

CLI11_INLINE void pxr_CLI::CLI::Option::run_callback ( )

Process the callback.

Definition at line 5186 of file CLI11.h.

Option* pxr_CLI::CLI::Option::run_callback_for_default ( bool  value = true)
inline

Set the value of run_callback_for_default which controls whether the callback function should be called to set the default This is controlled automatically but could be manipulated by the user.

Definition at line 4523 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::transform ( Validator  Validator,
const std::string Validator_name = "" 
)

Adds a transforming Validator with a built in type name.

Definition at line 4992 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::transform ( const std::function< std::string(std::string)> &  func,
std::string  transform_description = "",
std::string  transform_name = "" 
)

Adds a Validator-like function that can change result.

Definition at line 4999 of file CLI11.h.

Option* pxr_CLI::CLI::Option::trigger_on_parse ( bool  value = true)
inline

Set the value of trigger_on_parse which specifies that the option callback should be triggered on every parse.

Definition at line 4506 of file CLI11.h.

Option* pxr_CLI::CLI::Option::type_name ( std::string  typeval)
inline

Set a custom option typestring.

Definition at line 4840 of file CLI11.h.

Option* pxr_CLI::CLI::Option::type_name_fn ( std::function< std::string()>  typefun)
inline

Set the type function to run when displayed on this option.

Definition at line 4834 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::type_size ( int  option_type_size)

Set a custom option size.

Definition at line 5343 of file CLI11.h.

CLI11_INLINE Option * pxr_CLI::CLI::Option::type_size ( int  option_type_size_min,
int  option_type_size_max 
)

Set a custom option type size range.

Definition at line 5362 of file CLI11.h.

Member Data Documentation

bool pxr_CLI::CLI::Option::allow_extra_args_ {false}
protected

Specify that extra args beyond type_size_max should be allowed.

Definition at line 4446 of file CLI11.h.

callback_t pxr_CLI::CLI::Option::callback_ {}
protected

Options store a callback to do all the work.

Definition at line 4426 of file CLI11.h.

option_state pxr_CLI::CLI::Option::current_option_state_ {option_state::parsing}
protected

Whether the callback has run (needed for INI parsing)

Definition at line 4444 of file CLI11.h.

std::vector<std::pair<std::string, std::string> > pxr_CLI::CLI::Option::default_flag_values_ {}
protected

A list of the flag names with the appropriate default value, the first part of the pair should be duplicates of what is in snames or lnames but will trigger a particular response on a flag

Definition at line 4362 of file CLI11.h.

std::function<std::string()> pxr_CLI::CLI::Option::default_function_ {}
protected

Run this function to capture a default (ignore if empty)

Definition at line 4392 of file CLI11.h.

std::string pxr_CLI::CLI::Option::default_str_ {}
protected

A human readable default value, either manually set, captured, or captured by default.

Definition at line 4381 of file CLI11.h.

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

The description for help strings.

Definition at line 4378 of file CLI11.h.

std::string pxr_CLI::CLI::Option::envname_ {}
protected

If given, check the environment for this option.

Definition at line 4371 of file CLI11.h.

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

A list of options that are excluded with this option.

Definition at line 4416 of file CLI11.h.

int pxr_CLI::CLI::Option::expected_max_ {1}
protected

The maximum number of expected values.

Definition at line 4407 of file CLI11.h.

int pxr_CLI::CLI::Option::expected_min_ {1}
protected

The minimum number of expected values.

Definition at line 4405 of file CLI11.h.

bool pxr_CLI::CLI::Option::flag_like_ {false}
protected

Specify that the option should act like a flag vs regular option.

Definition at line 4448 of file CLI11.h.

std::vector<std::string> pxr_CLI::CLI::Option::fnames_ {}
protected

a list of flag names with specified default values;

Definition at line 4365 of file CLI11.h.

bool pxr_CLI::CLI::Option::force_callback_ {false}
protected

flag indicating that the option should force the callback regardless if any results present

Definition at line 4456 of file CLI11.h.

bool pxr_CLI::CLI::Option::inject_separator_ {false}
protected

flag indicating a separator needs to be injected after each argument call

Definition at line 4452 of file CLI11.h.

std::vector<std::string> pxr_CLI::CLI::Option::lnames_ {}
protected

A list of the long names (--long) without the leading dashes.

Definition at line 4358 of file CLI11.h.

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

A list of options that are required with this option.

Definition at line 4413 of file CLI11.h.

std::string pxr_CLI::CLI::Option::option_text_ {}
protected

If given, replace the text that describes the option type and usage in the help text.

Definition at line 4384 of file CLI11.h.

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

link back up to the parent App for fallthrough

Definition at line 4423 of file CLI11.h.

std::string pxr_CLI::CLI::Option::pname_ {}
protected

A positional name.

Definition at line 4368 of file CLI11.h.

results_t pxr_CLI::CLI::Option::proc_results_ {}
protected

results after reduction

Definition at line 4435 of file CLI11.h.

results_t pxr_CLI::CLI::Option::results_ {}
protected

complete Results of parsing

Definition at line 4433 of file CLI11.h.

bool pxr_CLI::CLI::Option::run_callback_for_default_ {false}
protected

Control option to run the callback to set the default.

Definition at line 4450 of file CLI11.h.

std::vector<std::string> pxr_CLI::CLI::Option::snames_ {}
protected

A list of the short names (-a) without the leading dashes.

Definition at line 4355 of file CLI11.h.

bool pxr_CLI::CLI::Option::trigger_on_result_ {false}
protected

flag indicating that the option should trigger the validation and callback chain on each result when loaded

Definition at line 4454 of file CLI11.h.

std::function<std::string()> pxr_CLI::CLI::Option::type_name_ {[]() { return std::string(); }}
protected

A human readable type value, set when App creates this

This is a lambda function so "types" can be dynamic, such as when a set prints its contents.

Definition at line 4389 of file CLI11.h.

int pxr_CLI::CLI::Option::type_size_max_ {1}
protected

The number of arguments that make up one option. max is the nominal type size, min is the minimum number of strings

Definition at line 4400 of file CLI11.h.

int pxr_CLI::CLI::Option::type_size_min_ {1}
protected

The minimum number of arguments an option should be expecting.

Definition at line 4402 of file CLI11.h.

std::vector<Validator> pxr_CLI::CLI::Option::validators_ {}
protected

A list of Validators to run on each value parsed.

Definition at line 4410 of file CLI11.h.


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