Commit d28c230e0b8860320466018c4e6e38f6ca19c237

Authored by Henry Fredrick Schreiner
Committed by Henry Schreiner
1 parent 44de4de1

Adding docs

Showing 2 changed files with 7 additions and 3 deletions
CHANGELOG.md
... ... @@ -15,9 +15,12 @@
15 15 * The order is now preserved for subcommands (list and callbacks) [#49](https://github.com/CLIUtils/CLI11/pull/49)
16 16 * Tests now run individually, utilizing CMake 3.10 additions if possible [#50](https://github.com/CLIUtils/CLI11/pull/50)
17 17 * Failure messages are now customizable, with a shorter default [#52](https://github.com/CLIUtils/CLI11/pull/52)
  18 +* Some improvements to error codes [#53](https://github.com/CLIUtils/CLI11/pull/53)
18 19 * `require_subcommand` now offers a two-argument form and negative values on the one-argument form are more useful [#51](https://github.com/CLIUtils/CLI11/pull/51)
19 20 * Subcommands no longer match after the max required number is obtained [#51](https://github.com/CLIUtils/CLI11/pull/51)
20 21 * Unlimited options no longer prioritize over remaining/unlimited positionals [#51](https://github.com/CLIUtils/CLI11/pull/51)
  22 +* Added `->transform` which modifies the string parsed [#54](https://github.com/CLIUtils/CLI11/pull/54)
  23 +* Changed of API in validators to `void(std::string &)` (const for users), throwing providing nicer errors [#54](https://github.com/CLIUtils/CLI11/pull/54)
21 24  
22 25 ## Version 1.2
23 26  
... ...
README.md
... ... @@ -170,8 +170,9 @@ The add commands return a pointer to an internally stored `Option`. If you set t
170 170 * `->check(CLI::ExistingDirectory)`: Requires that the directory exists.
171 171 * `->check(CLI::NonexistentPath)`: Requires that the path does not exist.
172 172 * `->check(CLI::Range(min,max))`: Requires that the option be between min and max (make sure to use floating point if needed). Min defaults to 0.
  173 +* `->transform(std::string(std::string))`: Converts the input string into the output string, in-place in the parsed options.
173 174  
174   -These options return the `Option` pointer, so you can chain them together, and even skip storing the pointer entirely. Check takes any function that has the signature `bool(std::string)`. If you just want to see the unconverted values, use `.results()` to get the `std::vector<std::string>` of results.
  175 +These options return the `Option` pointer, so you can chain them together, and even skip storing the pointer entirely. Check takes any function that has the signature `void(const std::string&)`; it should throw a `ValidationError` when validation fails. The help message will have the name of the parent option prepended. Since `check` and `transform` use the same underlying mechanism, you can chain as many as you want, and they will be executed in order. If you just want to see the unconverted values, use `.results()` to get the `std::vector<std::string>` of results.
175 176  
176 177  
177 178 On the command line, options can be given as:
... ... @@ -263,10 +264,10 @@ arguments, use `.config_to_str(default_also=false)`, where `default_also` will a
263 264  
264 265 Many of the defaults for subcommands and even options are inherited from their creators. The inherited default values for subcommands are `allow_extras`, `prefix_command`, `ignore_case`, `fallthrough`, `group`, `footer`, and maximum number of required subcommands. The help flag existence, name, and description are inherited, as well.
265 266  
266   -Options have defaults for `group`, `required`, `take_last`, and `ignore_case`. To set these defaults, you should set the `option_defauts()` object, for example:
  267 +Options have defaults for `group`, `required`, `take_last`, and `ignore_case`. To set these defaults, you should set the `option_defaults()` object, for example:
267 268  
268 269 ```cpp
269   -app.option_defauts()->required();
  270 +app.option_defaults()->required();
270 271 // All future options will be required
271 272 ```
272 273  
... ...