Commit 656dda169547368e5ff6457c3955de45eef2f90f

Authored by Henry Schreiner
Committed by Henry Schreiner
1 parent 989bdcd6

chore: bump version to 2.0.0

.appveyor.yml
1 -version: 1.9.1.{build} 1 +version: 2.0.0.{build}
2 2
3 branches: 3 branches:
4 only: 4 only:
README.md
@@ -83,7 +83,7 @@ An acceptable CLI parser library should be all of the following: @@ -83,7 +83,7 @@ An acceptable CLI parser library should be all of the following:
83 - Easy to execute, with help, parse errors, etc. providing correct exit and details. 83 - Easy to execute, with help, parse errors, etc. providing correct exit and details.
84 - Easy to extend as part of a framework that provides "applications" to users. 84 - Easy to extend as part of a framework that provides "applications" to users.
85 - Usable subcommand syntax, with support for multiple subcommands, nested subcommands, option groups, and optional fallthrough (explained later). 85 - Usable subcommand syntax, with support for multiple subcommands, nested subcommands, option groups, and optional fallthrough (explained later).
86 -- Ability to add a configuration file (`ini` or `TOML`πŸ†• format), and produce it as well. 86 +- Ability to add a configuration file (`TOML`, `INI`, or custom format), and produce it as well.
87 - Produce real values that can be used directly in code, not something you have pay compute time to look up, for HPC applications. 87 - Produce real values that can be used directly in code, not something you have pay compute time to look up, for HPC applications.
88 - Work with standard types, simple custom types, and extensible to exotic types. 88 - Work with standard types, simple custom types, and extensible to exotic types.
89 - Permissively licensed. 89 - Permissively licensed.
@@ -224,7 +224,7 @@ While all options internally are the same type, there are several ways to add an @@ -224,7 +224,7 @@ While all options internally are the same type, there are several ways to add an
224 app.add_option(option_name, help_str="") 224 app.add_option(option_name, help_str="")
225 225
226 app.add_option(option_name, 226 app.add_option(option_name,
227 - variable_to_bind_to, // bool, char(see note)🚧, int, float, vector, enum, std::atomic 🚧, or string-like, or anything with a defined conversion from a string or that takes an int πŸ†•, double πŸ†•, or string in a constructor. Also allowed are tuples πŸ†•, std::array πŸ†• or std::pair πŸ†•. Also supported are complex numbers🚧, wrapper types🚧, and containers besides vector🚧 of any other supported type. 227 + variable_to_bind_to, // bool, char(see note)πŸ†•, int, float, vector, enum, std::atomic πŸ†•, or string-like, or anything with a defined conversion from a string or that takes an int, double, or string in a constructor. Also allowed are tuples, std::array or std::pair. Also supported are complex numbersπŸ†•, wrapper typesπŸ†•, and containers besides vectorπŸ†• of any other supported type.
228 help_string="") 228 help_string="")
229 229
230 app.add_option_function<type>(option_name, 230 app.add_option_function<type>(option_name,
@@ -233,7 +233,7 @@ app.add_option_function&lt;type&gt;(option_name, @@ -233,7 +233,7 @@ app.add_option_function&lt;type&gt;(option_name,
233 233
234 // char as an option type is supported before 2.0 but in 2.0 it defaulted to allowing single non numerical characters in addition to the numeric values. 234 // char as an option type is supported before 2.0 but in 2.0 it defaulted to allowing single non numerical characters in addition to the numeric values.
235 235
236 -// πŸ†• There is a template overload which takes two template parameters the first is the type of object to assign the value to, the second is the conversion type. The conversion type should have a known way to convert from a string, such as any of the types that work in the non-template version. If XC is a std::pair and T is some non pair type. Then a two argument constructor for T is called to assign the value. For tuples or other multi element types, XC must be a single type or a tuple like object of the same size as the assignment type 236 +// There is a template overload which takes two template parameters the first is the type of object to assign the value to, the second is the conversion type. The conversion type should have a known way to convert from a string, such as any of the types that work in the non-template version. If XC is a std::pair and T is some non pair type. Then a two argument constructor for T is called to assign the value. For tuples or other multi element types, XC must be a single type or a tuple like object of the same size as the assignment type
237 app.add_option<typename T, typename XC>(option_name, 237 app.add_option<typename T, typename XC>(option_name,
238 T &output, // output must be assignable or constructible from a value of type XC 238 T &output, // output must be assignable or constructible from a value of type XC
239 help_string="") 239 help_string="")
@@ -243,7 +243,7 @@ app.add_flag(option_name, @@ -243,7 +243,7 @@ app.add_flag(option_name,
243 help_string="") 243 help_string="")
244 244
245 app.add_flag(option_name, 245 app.add_flag(option_name,
246 - variable_to_bind_to, // bool, int, float, complex, containers, enum, std::atomic 🚧, or string-like, or any singular object with a defined conversion from a string like add_option 246 + variable_to_bind_to, // bool, int, float, complex, containers, enum, std::atomic πŸ†•, or string-like, or any singular object with a defined conversion from a string like add_option
247 help_string="") 247 help_string="")
248 248
249 app.add_flag_function(option_name, 249 app.add_flag_function(option_name,
@@ -262,7 +262,7 @@ An option name must start with a alphabetic character, underscore, a number, &#39;?&#39; @@ -262,7 +262,7 @@ An option name must start with a alphabetic character, underscore, a number, &#39;?&#39;
262 262
263 The `add_option_function<type>(...` function will typically require the template parameter be given unless a `std::function` object with an exact match is passed. The type can be any type supported by the `add_option` function. The function should throw an error (`CLI::ConversionError` or `CLI::ValidationError` possibly) if the value is not valid. 263 The `add_option_function<type>(...` function will typically require the template parameter be given unless a `std::function` object with an exact match is passed. The type can be any type supported by the `add_option` function. The function should throw an error (`CLI::ConversionError` or `CLI::ValidationError` possibly) if the value is not valid.
264 264
265 -πŸ†• The two parameter template overload can be used in cases where you want to restrict the input such as 265 +The two parameter template overload can be used in cases where you want to restrict the input such as
266 ``` 266 ```
267 double val 267 double val
268 app.add_option<double,unsigned int>("-v",val); 268 app.add_option<double,unsigned int>("-v",val);
@@ -336,7 +336,7 @@ Before parsing, you can set the following options: @@ -336,7 +336,7 @@ Before parsing, you can set the following options:
336 - `->ignore_case()`: Ignore the case on the command line (also works on subcommands, does not affect arguments). 336 - `->ignore_case()`: Ignore the case on the command line (also works on subcommands, does not affect arguments).
337 - `->ignore_underscore()`: Ignore any underscores in the options names (also works on subcommands, does not affect arguments). For example "option_one" will match with "optionone". This does not apply to short form options since they only have one character 337 - `->ignore_underscore()`: Ignore any underscores in the options names (also works on subcommands, does not affect arguments). For example "option_one" will match with "optionone". This does not apply to short form options since they only have one character
338 - `->disable_flag_override()`: From the command line long form flag options can be assigned a value on the command line using the `=` notation `--flag=value`. If this behavior is not desired, the `disable_flag_override()` disables it and will generate an exception if it is done on the command line. The `=` does not work with short form flag options. 338 - `->disable_flag_override()`: From the command line long form flag options can be assigned a value on the command line using the `=` notation `--flag=value`. If this behavior is not desired, the `disable_flag_override()` disables it and will generate an exception if it is done on the command line. The `=` does not work with short form flag options.
339 -- `->allow_extra_args(true/false)`: 🚧 If set to true the option will take an unlimited number of arguments like a vector, if false it will limit the number of arguments to the size of the type used in the option. Default value depends on the nature of the type use, containers default to true, others default to false. 339 +- `->allow_extra_args(true/false)`: πŸ†• If set to true the option will take an unlimited number of arguments like a vector, if false it will limit the number of arguments to the size of the type used in the option. Default value depends on the nature of the type use, containers default to true, others default to false.
340 - `->delimiter(char)`: Allows specification of a custom delimiter for separating single arguments into vector arguments, for example specifying `->delimiter(',')` on an option would result in `--opt=1,2,3` producing 3 elements of a vector and the equivalent of --opt 1 2 3 assuming opt is a vector value. 340 - `->delimiter(char)`: Allows specification of a custom delimiter for separating single arguments into vector arguments, for example specifying `->delimiter(',')` on an option would result in `--opt=1,2,3` producing 3 elements of a vector and the equivalent of --opt 1 2 3 assuming opt is a vector value.
341 - `->description(str)`: Set/change the description. 341 - `->description(str)`: Set/change the description.
342 - `->multi_option_policy(CLI::MultiOptionPolicy::Throw)`: Set the multi-option policy. Shortcuts available: `->take_last()`, `->take_first()`,`->take_all()`, and `->join()`. This will only affect options expecting 1 argument or bool flags (which do not inherit their default but always start with a specific policy). 342 - `->multi_option_policy(CLI::MultiOptionPolicy::Throw)`: Set the multi-option policy. Shortcuts available: `->take_last()`, `->take_first()`,`->take_all()`, and `->join()`. This will only affect options expecting 1 argument or bool flags (which do not inherit their default but always start with a specific policy).
@@ -350,7 +350,7 @@ Before parsing, you can set the following options: @@ -350,7 +350,7 @@ Before parsing, you can set the following options:
350 - `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses. 350 - `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses.
351 - `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`. 351 - `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`.
352 - `->default_str(string)`: Set the default string directly. This string will also be used as a default value if no arguments are passed and the value is requested. 352 - `->default_str(string)`: Set the default string directly. This string will also be used as a default value if no arguments are passed and the value is requested.
353 -- `->default_val(value)`: πŸ†• Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator). 353 +- `->default_val(value)`: Generate the default string from a value and validate that the value is also valid. For options that assign directly to a value type the value in that type is also updated. Value must be convertible to a string(one of known types or have a stream operator).
354 - `->option_text(string)`: Sets the text between the option name and description. 354 - `->option_text(string)`: Sets the text between the option name and description.
355 355
356 356
@@ -407,7 +407,7 @@ CLI11 has several Validators built-in that perform some common checks @@ -407,7 +407,7 @@ CLI11 has several Validators built-in that perform some common checks
407 - `CLI::NonNegativeNumber`: Requires the number be greater or equal to 0 407 - `CLI::NonNegativeNumber`: Requires the number be greater or equal to 0
408 - `CLI::Number`: Requires the input be a number. 408 - `CLI::Number`: Requires the input be a number.
409 - `CLI::ValidIPV4`: Requires that the option be a valid IPv4 string e.g. `'255.255.255.255'`, `'10.1.1.7'`. 409 - `CLI::ValidIPV4`: Requires that the option be a valid IPv4 string e.g. `'255.255.255.255'`, `'10.1.1.7'`.
410 -- `CLI::TypeValidator<TYPE>`:🚧 Requires that the option be convertible to the specified type e.g. `CLI::TypeValidator<unsigned int>()` would require that the input be convertible to an `unsigned int` regardless of the end conversion. 410 +- `CLI::TypeValidator<TYPE>`:πŸ†• Requires that the option be convertible to the specified type e.g. `CLI::TypeValidator<unsigned int>()` would require that the input be convertible to an `unsigned int` regardless of the end conversion.
411 411
412 These Validators can be used by simply passing the name into the `check` or `transform` methods on an option 412 These Validators can be used by simply passing the name into the `check` or `transform` methods on an option
413 413
@@ -460,7 +460,7 @@ NOTES: If the container used in `IsMember`, `Transformer`, or `CheckedTransform @@ -460,7 +460,7 @@ NOTES: If the container used in `IsMember`, `Transformer`, or `CheckedTransform
460 Validators are copyable and have a few operations that can be performed on them to alter settings. Most of the built in Validators have a default description that is displayed in the help. This can be altered via `.description(validator_description)`. 460 Validators are copyable and have a few operations that can be performed on them to alter settings. Most of the built in Validators have a default description that is displayed in the help. This can be altered via `.description(validator_description)`.
461 The name of a Validator, which is useful for later reference from the `get_validator(name)` method of an `Option` can be set via `.name(validator_name)` 461 The name of a Validator, which is useful for later reference from the `get_validator(name)` method of an `Option` can be set via `.name(validator_name)`
462 The operation function of a Validator can be set via 462 The operation function of a Validator can be set via
463 -`.operation(std::function<std::string(std::string &>)`. The `.active()` function can activate or deactivate a Validator from the operation. A validator can be set to apply only to a specific element of the output. For example in a pair option `std::pair<int, std::string>` the first element may need to be a positive integer while the second may need to be a valid file. The `.application_index(int)` πŸ†• function can specify this. It is zero based and negative indices apply to all values. 463 +`.operation(std::function<std::string(std::string &>)`. The `.active()` function can activate or deactivate a Validator from the operation. A validator can be set to apply only to a specific element of the output. For example in a pair option `std::pair<int, std::string>` the first element may need to be a positive integer while the second may need to be a valid file. The `.application_index(int)` function can specify this. It is zero based and negative indices apply to all values.
464 ```cpp 464 ```cpp
465 opt->check(CLI::Validator(CLI::PositiveNumber).application_index(0)); 465 opt->check(CLI::Validator(CLI::PositiveNumber).application_index(0));
466 opt->check(CLI::Validator(CLI::ExistingFile).application_index(1)); 466 opt->check(CLI::Validator(CLI::ExistingFile).application_index(1));
@@ -505,7 +505,7 @@ opt-&gt;get_validator(name); @@ -505,7 +505,7 @@ opt-&gt;get_validator(name);
505 505
506 This will retrieve a Validator with the given name or throw a `CLI::OptionNotFound` error. If no name is given or name is empty the first unnamed Validator will be returned or the first Validator if there is only one. 506 This will retrieve a Validator with the given name or throw a `CLI::OptionNotFound` error. If no name is given or name is empty the first unnamed Validator will be returned or the first Validator if there is only one.
507 507
508 -or πŸ†• 508 +or
509 509
510 ```cpp 510 ```cpp
511 opt->get_validator(index); 511 opt->get_validator(index);
@@ -516,7 +516,7 @@ Validators have a few functions to query the current values @@ -516,7 +516,7 @@ Validators have a few functions to query the current values
516 - `get_description()`: Will return a description string 516 - `get_description()`: Will return a description string
517 - `get_name()`: Will return the Validator name 517 - `get_name()`: Will return the Validator name
518 - `get_active()`: Will return the current active state, true if the Validator is active. 518 - `get_active()`: Will return the current active state, true if the Validator is active.
519 -- `get_application_index()`: πŸ†• Will return the current application index. 519 +- `get_application_index()`: Will return the current application index.
520 - `get_modifying()`: Will return true if the Validator is allowed to modify the input, this can be controlled via the `non_modifying()` method, though it is recommended to let `check` and `transform` option methods manipulate it if needed. 520 - `get_modifying()`: Will return true if the Validator is allowed to modify the input, this can be controlled via the `non_modifying()` method, though it is recommended to let `check` and `transform` option methods manipulate it if needed.
521 521
522 #### Getting results 522 #### Getting results
@@ -554,14 +554,14 @@ There are several options that are supported on the main app and subcommands and @@ -554,14 +554,14 @@ There are several options that are supported on the main app and subcommands and
554 - `.ignore_underscore()`: Ignore any underscores in the subcommand name. Inherited by added subcommands, so is usually used on the main `App`. 554 - `.ignore_underscore()`: Ignore any underscores in the subcommand name. Inherited by added subcommands, so is usually used on the main `App`.
555 - `.allow_windows_style_options()`: Allow command line options to be parsed in the form of `/s /long /file:file_name.ext` This option does not change how options are specified in the `add_option` calls or the ability to process options in the form of `-s --long --file=file_name.ext`. 555 - `.allow_windows_style_options()`: Allow command line options to be parsed in the form of `/s /long /file:file_name.ext` This option does not change how options are specified in the `add_option` calls or the ability to process options in the form of `-s --long --file=file_name.ext`.
556 - `.fallthrough()`: Allow extra unmatched options and positionals to "fall through" and be matched on a parent option. Subcommands always are allowed to "fall through" as in they will first attempt to match on the current subcommand and if they fail will progressively check parents for matching subcommands. 556 - `.fallthrough()`: Allow extra unmatched options and positionals to "fall through" and be matched on a parent option. Subcommands always are allowed to "fall through" as in they will first attempt to match on the current subcommand and if they fail will progressively check parents for matching subcommands.
557 -- `.configurable()`: πŸ†• Allow the subcommand to be triggered from a configuration file. By default subcommand options in a configuration file do not trigger a subcommand but will just update default values. 557 +- `.configurable()`: Allow the subcommand to be triggered from a configuration file. By default subcommand options in a configuration file do not trigger a subcommand but will just update default values.
558 - `.disable()`: Specify that the subcommand is disabled, if given with a bool value it will enable or disable the subcommand or option group. 558 - `.disable()`: Specify that the subcommand is disabled, if given with a bool value it will enable or disable the subcommand or option group.
559 - `.disabled_by_default()`: Specify that at the start of parsing the subcommand/option_group should be disabled. This is useful for allowing some Subcommands to trigger others. 559 - `.disabled_by_default()`: Specify that at the start of parsing the subcommand/option_group should be disabled. This is useful for allowing some Subcommands to trigger others.
560 - `.enabled_by_default()`: Specify that at the start of each parse the subcommand/option_group should be enabled. This is useful for allowing some Subcommands to disable others. 560 - `.enabled_by_default()`: Specify that at the start of each parse the subcommand/option_group should be enabled. This is useful for allowing some Subcommands to disable others.
561 -- `.silent()`: 🚧 Specify that the subcommand is silent meaning that if used it won't show up in the subcommand list. This allows the use of subcommands as modifiers 561 +- `.silent()`: πŸ†• Specify that the subcommand is silent meaning that if used it won't show up in the subcommand list. This allows the use of subcommands as modifiers
562 - `.validate_positionals()`: Specify that positionals should pass validation before matching. Validation is specified through `transform`, `check`, and `each` for an option. If an argument fails validation it is not an error and matching proceeds to the next available positional or extra arguments. 562 - `.validate_positionals()`: Specify that positionals should pass validation before matching. Validation is specified through `transform`, `check`, and `each` for an option. If an argument fails validation it is not an error and matching proceeds to the next available positional or extra arguments.
563 - `.excludes(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, these subcommands cannot be given together. In the case of options, if the option is passed the subcommand cannot be used and will generate an error. 563 - `.excludes(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, these subcommands cannot be given together. In the case of options, if the option is passed the subcommand cannot be used and will generate an error.
564 -- `.needs(option_or_subcommand)`: πŸ†• If given an option pointer or pointer to another subcommand, the subcommands will require the given option to have been given before this subcommand is validated which occurs prior to execution of any callback or after parsing is completed. 564 +- `.needs(option_or_subcommand)`: If given an option pointer or pointer to another subcommand, the subcommands will require the given option to have been given before this subcommand is validated which occurs prior to execution of any callback or after parsing is completed.
565 - `.require_option()`: Require 1 or more options or option groups be used. 565 - `.require_option()`: Require 1 or more options or option groups be used.
566 - `.require_option(N)`: Require `N` options or option groups, if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more. 566 - `.require_option(N)`: Require `N` options or option groups, if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more.
567 - `.require_option(min, max)`: Explicitly set min and max allowed options or option groups. Setting `max` to 0 implies unlimited options. 567 - `.require_option(min, max)`: Explicitly set min and max allowed options or option groups. Setting `max` to 0 implies unlimited options.
@@ -582,24 +582,24 @@ There are several options that are supported on the main app and subcommands and @@ -582,24 +582,24 @@ There are several options that are supported on the main app and subcommands and
582 - `.formatter(fmt)`: Set a formatter, with signature `std::string(const App*, std::string, AppFormatMode)`. See Formatting for more details. 582 - `.formatter(fmt)`: Set a formatter, with signature `std::string(const App*, std::string, AppFormatMode)`. See Formatting for more details.
583 - `.description(str)`: Set/change the description. 583 - `.description(str)`: Set/change the description.
584 - `.get_description()`: Access the description. 584 - `.get_description()`: Access the description.
585 -- `.alias(str)`: πŸ†• set an alias for the subcommand, this allows subcommands to be called by more than one name. 585 +- `.alias(str)`: set an alias for the subcommand, this allows subcommands to be called by more than one name.
586 - `.parsed()`: True if this subcommand was given on the command line. 586 - `.parsed()`: True if this subcommand was given on the command line.
587 - `.count()`: Returns the number of times the subcommand was called. 587 - `.count()`: Returns the number of times the subcommand was called.
588 - `.count(option_name)`: Returns the number of times a particular option was called. 588 - `.count(option_name)`: Returns the number of times a particular option was called.
589 - `.count_all()`: Returns the total number of arguments a particular subcommand processed, on the master App it returns the total number of processed commands. 589 - `.count_all()`: Returns the total number of arguments a particular subcommand processed, on the master App it returns the total number of processed commands.
590 - `.name(name)`: Add or change the name. 590 - `.name(name)`: Add or change the name.
591 -- `.callback(void() function)`: Set the callback for an app. πŸ†• either sets the pre_parse_callback or the final_callback depending on the value of `immediate_callback`. See [Subcommand callbacks](#callbacks) for some additional details.  
592 -- `.parse_complete_callback(void() function)`: πŸ†• Set the callback that runs at the completion of parsing. for subcommands this is executed at the completion of the single subcommand and can be executed multiple times. See [Subcommand callbacks](#callbacks) for some additional details.  
593 -- `.final_callback(void() function)`: πŸ†• Set the callback that runs at the end of all processing. This is the last thing that is executed before returning. See [Subcommand callbacks](#callbacks) for some additional details.  
594 -- `.immediate_callback()`: Specifies whether the callback for a subcommand should be run as a `parse_complete_callback`(true) or `final_callback`(false). When used on the main app πŸ†• it will execute the main app callback prior to the callbacks for a subcommand if they do not also have the `immediate_callback` flag set. πŸ†• It is preferable to use the `parse_complete_callback` or `final_callback` directly instead of the `callback` and `immediate_callback` if one wishes to control the ordering and timing of callback. Though `immediate_callback` can be used to swap them if that is needed. 591 +- `.callback(void() function)`: Set the callback for an app. Either sets the `pre_parse_callback` or the `final_callback` depending on the value of `immediate_callback`. See [Subcommand callbacks](#callbacks) for some additional details.
  592 +- `.parse_complete_callback(void() function)`: Set the callback that runs at the completion of parsing. For subcommands this is executed at the completion of the single subcommand and can be executed multiple times. See [Subcommand callbacks](#callbacks) for some additional details.
  593 +- `.final_callback(void() function)`: Set the callback that runs at the end of all processing. This is the last thing that is executed before returning. See [Subcommand callbacks](#callbacks) for some additional details.
  594 +- `.immediate_callback()`: Specifies whether the callback for a subcommand should be run as a `parse_complete_callback`(true) or `final_callback`(false). When used on the main app it will execute the main app callback prior to the callbacks for a subcommand if they do not also have the `immediate_callback` flag set. It is preferable to use the `parse_complete_callback` or `final_callback` directly instead of the `callback` and `immediate_callback` if one wishes to control the ordering and timing of callback. Though `immediate_callback` can be used to swap them if that is needed.
595 - `.pre_parse_callback(void(std::size_t) function)`: Set a callback that executes after the first argument of an application is processed. See [Subcommand callbacks](#callbacks) for some additional details. 595 - `.pre_parse_callback(void(std::size_t) function)`: Set a callback that executes after the first argument of an application is processed. See [Subcommand callbacks](#callbacks) for some additional details.
596 - `.allow_extras()`: Do not throw an error if extra arguments are left over. 596 - `.allow_extras()`: Do not throw an error if extra arguments are left over.
597 - `.positionals_at_end()`: Specify that positional arguments occur as the last arguments and throw an error if an unexpected positional is encountered. 597 - `.positionals_at_end()`: Specify that positional arguments occur as the last arguments and throw an error if an unexpected positional is encountered.
598 - `.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognized item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app. 598 - `.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognized item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app.
599 - `.footer(message)`: Set text to appear at the bottom of the help string. 599 - `.footer(message)`: Set text to appear at the bottom of the help string.
600 -- `.footer(std::string())`: πŸ†• Set a callback to generate a string that will appear at the end of the help string. 600 +- `.footer(std::string())`: Set a callback to generate a string that will appear at the end of the help string.
601 - `.set_help_flag(name, message)`: Set the help flag name and message, returns a pointer to the created option. 601 - `.set_help_flag(name, message)`: Set the help flag name and message, returns a pointer to the created option.
602 -- `.set_version_flag(name, versionString or callback, help_message)`: πŸ†• Set the version flag name and version string or callback and optional help message, returns a pointer to the created option. 602 +- `.set_version_flag(name, versionString or callback, help_message)`: Set the version flag name and version string or callback and optional help message, returns a pointer to the created option.
603 - `.set_help_all_flag(name, message)`: Set the help all flag name and message, returns a pointer to the created option. Expands subcommands. 603 - `.set_help_all_flag(name, message)`: Set the help all flag name and message, returns a pointer to the created option. Expands subcommands.
604 - `.failure_message(func)`: Set the failure message function. Two provided: `CLI::FailureMessage::help` and `CLI::FailureMessage::simple` (the default). 604 - `.failure_message(func)`: Set the failure message function. Two provided: `CLI::FailureMessage::help` and `CLI::FailureMessage::simple` (the default).
605 - `.group(name)`: Set a group name, defaults to `"Subcommands"`. Setting `""` will be hide the subcommand. 605 - `.group(name)`: Set a group name, defaults to `"Subcommands"`. Setting `""` will be hide the subcommand.
@@ -610,7 +610,7 @@ There are several options that are supported on the main app and subcommands and @@ -610,7 +610,7 @@ There are several options that are supported on the main app and subcommands and
610 610
611 #### Callbacks 611 #### Callbacks
612 A subcommand has three optional callbacks that are executed at different stages of processing. The `preparse_callback` is executed once after the first argument of a subcommand or application is processed and gives an argument for the number of remaining arguments to process. For the main app the first argument is considered the program name, for subcommands the first argument is the subcommand name. For Option groups and nameless subcommands the first argument is after the first argument or subcommand is processed from that group. 612 A subcommand has three optional callbacks that are executed at different stages of processing. The `preparse_callback` is executed once after the first argument of a subcommand or application is processed and gives an argument for the number of remaining arguments to process. For the main app the first argument is considered the program name, for subcommands the first argument is the subcommand name. For Option groups and nameless subcommands the first argument is after the first argument or subcommand is processed from that group.
613 -The second callback is executed after parsing. This is known as the `parse_complete_callback`. For subcommands this is executed immediately after parsing and can be executed multiple times if a subcommand is called multiple times. On the main app this callback is executed after all the `parse_complete_callback`s for the subcommands are executed but prior to any `final_callback` calls in the subcommand or option groups. If the main app or subcommand has a config file, no data from the config file will be reflected in `parse_complete_callback` on named subcommands πŸ†•. For `option_group`s the `parse_complete_callback` is executed prior to the `parse_complete_callback` on the main app but after the `config_file` is loaded (if specified). The πŸ†• `final_callback` is executed after all processing is complete. After the `parse_complete_callback` is executed on the main app, the used subcommand `final_callback` are executed followed by the "final callback" for option groups. The last thing to execute is the `final_callback` for the `main_app`. 613 +The second callback is executed after parsing. This is known as the `parse_complete_callback`. For subcommands this is executed immediately after parsing and can be executed multiple times if a subcommand is called multiple times. On the main app this callback is executed after all the `parse_complete_callback`s for the subcommands are executed but prior to any `final_callback` calls in the subcommand or option groups. If the main app or subcommand has a config file, no data from the config file will be reflected in `parse_complete_callback` on named subcommands. For `option_group`s the `parse_complete_callback` is executed prior to the `parse_complete_callback` on the main app but after the `config_file` is loaded (if specified). The `final_callback` is executed after all processing is complete. After the `parse_complete_callback` is executed on the main app, the used subcommand `final_callback` are executed followed by the "final callback" for option groups. The last thing to execute is the `final_callback` for the `main_app`.
614 For example say an application was set up like 614 For example say an application was set up like
615 615
616 ```cpp 616 ```cpp
@@ -685,7 +685,7 @@ CLI::TriggerOff(group2_pointer, disabled_group); @@ -685,7 +685,7 @@ CLI::TriggerOff(group2_pointer, disabled_group);
685 685
686 These functions make use of `preparse_callback`, `enabled_by_default()` and `disabled_by_default`. The triggered group may be a vector of group pointers. These methods should only be used once per group and will override any previous use of the underlying functions. More complex arrangements can be accomplished using similar methodology with a custom `preparse_callback` function that does more. 686 These functions make use of `preparse_callback`, `enabled_by_default()` and `disabled_by_default`. The triggered group may be a vector of group pointers. These methods should only be used once per group and will override any previous use of the underlying functions. More complex arrangements can be accomplished using similar methodology with a custom `preparse_callback` function that does more.
687 687
688 -Additional helper functions `deprecate_option` πŸ†• and `retire_option` πŸ†• are available to deprecate or retire options 688 +Additional helper functions `deprecate_option` and `retire_option` are available to deprecate or retire options
689 ```cpp 689 ```cpp
690 CLI::deprecate_option(option *, replacement_name=""); 690 CLI::deprecate_option(option *, replacement_name="");
691 CLI::deprecate_option(App,option_name,replacement_name=""); 691 CLI::deprecate_option(App,option_name,replacement_name="");
@@ -714,7 +714,7 @@ app.set_config(option_name=&quot;&quot;, @@ -714,7 +714,7 @@ app.set_config(option_name=&quot;&quot;,
714 required=false) 714 required=false)
715 ``` 715 ```
716 716
717 -If this is called with no arguments, it will remove the configuration file option (like `set_help_flag`). Setting a configuration option is special. If it is present, it will be read along with the normal command line arguments. The file will be read if it exists, and does not throw an error unless `required` is `true`. Configuration files are in [TOML] format by default 🚧, though the default reader can also accept files in INI format as well πŸ†•. It should be noted that CLI11 does not contain a full TOML parser but can read strings from most TOML file and run them through the CLI11 parser. Other formats can be added by an adept user, some variations are available through customization points in the default formatter. An example of a TOML file πŸ†•: 717 +If this is called with no arguments, it will remove the configuration file option (like `set_help_flag`). Setting a configuration option is special. If it is present, it will be read along with the normal command line arguments. The file will be read if it exists, and does not throw an error unless `required` is `true`. Configuration files are in [TOML] format by default πŸ†•, though the default reader can also accept files in INI format as well. It should be noted that CLI11 does not contain a full TOML parser but can read strings from most TOML file and run them through the CLI11 parser. Other formats can be added by an adept user, some variations are available through customization points in the default formatter. An example of a TOML file:
718 718
719 ```toml 719 ```toml
720 # Comments are supported, using a # 720 # Comments are supported, using a #
@@ -746,7 +746,7 @@ in_subcommand = Wow @@ -746,7 +746,7 @@ in_subcommand = Wow
746 sub.subcommand = true 746 sub.subcommand = true
747 ``` 747 ```
748 748
749 -Spaces before and after the name and argument are ignored. Multiple arguments are separated by spaces. One set of quotes will be removed, preserving spaces (the same way the command line works). Boolean options can be `true`, `on`, `1`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case insensitive). Sections (and `.` separated names) are treated as subcommands (note: this does not necessarily mean that subcommand was passed, it just sets the "defaults"). You cannot set positional-only arguments. πŸ†• Subcommands can be triggered from configuration files if the `configurable` flag was set on the subcommand. Then the use of `[subcommand]` notation will trigger a subcommand and cause it to act as if it were on the command line. 749 +Spaces before and after the name and argument are ignored. Multiple arguments are separated by spaces. One set of quotes will be removed, preserving spaces (the same way the command line works). Boolean options can be `true`, `on`, `1`, `yes`, `enable`; or `false`, `off`, `0`, `no`, `disable` (case insensitive). Sections (and `.` separated names) are treated as subcommands (note: this does not necessarily mean that subcommand was passed, it just sets the "defaults"). You cannot set positional-only arguments. Subcommands can be triggered from configuration files if the `configurable` flag was set on the subcommand. Then the use of `[subcommand]` notation will trigger a subcommand and cause it to act as if it were on the command line.
750 750
751 To print a configuration file from the passed 751 To print a configuration file from the passed
752 arguments, use `.config_to_str(default_also=false, write_description=false)`, where `default_also` will also show any defaulted arguments, and `write_description` will include the app and option descriptions. See [Config files](https://cliutils.github.io/CLI11/book/chapters/config.html) for some additional details. 752 arguments, use `.config_to_str(default_also=false, write_description=false)`, where `default_also` will also show any defaulted arguments, and `write_description` will include the app and option descriptions. See [Config files](https://cliutils.github.io/CLI11/book/chapters/config.html) for some additional details.
@@ -757,7 +757,7 @@ If it is desired that multiple configuration be allowed. Use @@ -757,7 +757,7 @@ If it is desired that multiple configuration be allowed. Use
757 app.set_config("--config")->expected(1, X); 757 app.set_config("--config")->expected(1, X);
758 ``` 758 ```
759 759
760 -Where X is some positive number and will allow up to `X` configuration files to be specified by separate `--config` arguments. Value strings with quote characters in it will be printed with a single quote.🚧 All other arguments will use double quote. Empty strings will use a double quoted argument.🚧 Numerical or boolean values are not quoted. 🚧 760 +Where X is some positive number and will allow up to `X` configuration files to be specified by separate `--config` arguments. Value strings with quote characters in it will be printed with a single quote.πŸ†• All other arguments will use double quote. Empty strings will use a double quoted argument.πŸ†• Numerical or boolean values are not quoted. πŸ†•
761 761
762 ### Inheriting defaults 762 ### Inheriting defaults
763 763
include/CLI/Version.hpp
@@ -8,9 +8,9 @@ @@ -8,9 +8,9 @@
8 8
9 // [CLI11:version_hpp:verbatim] 9 // [CLI11:version_hpp:verbatim]
10 10
11 -#define CLI11_VERSION_MAJOR 1  
12 -#define CLI11_VERSION_MINOR 9  
13 -#define CLI11_VERSION_PATCH 1  
14 -#define CLI11_VERSION "1.9.1" 11 +#define CLI11_VERSION_MAJOR 2
  12 +#define CLI11_VERSION_MINOR 0
  13 +#define CLI11_VERSION_PATCH 0
  14 +#define CLI11_VERSION "2.0.0"
15 15
16 // [CLI11:version_hpp:end] 16 // [CLI11:version_hpp:end]