Commit 2ea663bcc7b9cb37806ed50e271f9e1f17bdc9d4

Authored by Henry Schreiner
Committed by Henry Schreiner
1 parent 46981312

style: add remarklint

.pre-commit-config.yaml
@@ -49,6 +49,16 @@ repos: @@ -49,6 +49,16 @@ repos:
49 49
50 - repo: local 50 - repo: local
51 hooks: 51 hooks:
  52 + - id: remarklint
  53 + name: remarklint
  54 + language: node
  55 + entry: remark
  56 + types: [markdown]
  57 + args: ["--frail", "--quiet"]
  58 + additional_dependencies: [remark, remark-lint, remark-cli, remark-preset-lint-recommended, remark-lint-list-item-indent, remark-lint-no-undefined-references]
  59 +
  60 +- repo: local
  61 + hooks:
52 - id: disallow-caps 62 - id: disallow-caps
53 name: Disallow improper capitalization 63 name: Disallow improper capitalization
54 language: pygrep 64 language: pygrep
.remarkrc 0 โ†’ 100644
  1 +{
  2 + "plugins": [
  3 + "remark-preset-lint-recommended",
  4 + ["remark-lint-list-item-indent", "space"],
  5 + ["remark-lint-no-undefined-references", {"allow": ["^1"]}]
  6 + ]
  7 +}
CHANGELOG.md
@@ -149,6 +149,7 @@ configuration options were added to facilitate a wider variety of apps. GCC @@ -149,6 +149,7 @@ configuration options were added to facilitate a wider variety of apps. GCC
149 [#373]: https://github.com/CLIUtils/CLI11/pull/373 149 [#373]: https://github.com/CLIUtils/CLI11/pull/373
150 [#374]: https://github.com/CLIUtils/CLI11/pull/374 150 [#374]: https://github.com/CLIUtils/CLI11/pull/374
151 [#382]: https://github.com/CLIUtils/CLI11/pull/382 151 [#382]: https://github.com/CLIUtils/CLI11/pull/382
  152 +[#387]: https://github.com/CLIUtils/CLI11/pull/387
152 [#390]: https://github.com/CLIUtils/CLI11/pull/390 153 [#390]: https://github.com/CLIUtils/CLI11/pull/390
153 [#394]: https://github.com/CLIUtils/CLI11/pull/394 154 [#394]: https://github.com/CLIUtils/CLI11/pull/394
154 [#400]: https://github.com/CLIUtils/CLI11/pull/400 155 [#400]: https://github.com/CLIUtils/CLI11/pull/400
@@ -187,7 +188,7 @@ Set handling has been completely replaced by a new backend that works as a Valid @@ -187,7 +188,7 @@ Set handling has been completely replaced by a new backend that works as a Valid
187 * Support for composable unnamed subcommands [#216][] 188 * Support for composable unnamed subcommands [#216][]
188 * Reparsing is better supported with `.remaining_for_passthrough()` [#265][] 189 * Reparsing is better supported with `.remaining_for_passthrough()` [#265][]
189 * Custom vector separator using `->delimiter(char)` [#209][], [#221][], [#240][] 190 * Custom vector separator using `->delimiter(char)` [#209][], [#221][], [#240][]
190 -* Validators added for IP4 addresses and positive numbers [#210] and numbers [#262][] 191 +* Validators added for IP4 addresses and positive numbers [#210][] and numbers [#262][]
191 * Minimum required Boost for optional Optionals has been corrected to 1.61 [#226][] 192 * Minimum required Boost for optional Optionals has been corrected to 1.61 [#226][]
192 * Positionals can stop options from being parsed with `app.positionals_at_end()` [#223][] 193 * Positionals can stop options from being parsed with `app.positionals_at_end()` [#223][]
193 * Added `validate_positionals` [#262][] 194 * Added `validate_positionals` [#262][]
@@ -248,9 +249,9 @@ Passing the same subcommand multiple times is better supported. Several new feat @@ -248,9 +249,9 @@ Passing the same subcommand multiple times is better supported. Several new feat
248 * The default message now will mention the help-all flag also if present [#197][] 249 * The default message now will mention the help-all flag also if present [#197][]
249 * Added `->description` to set Option descriptions [#199][] 250 * Added `->description` to set Option descriptions [#199][]
250 * Mutating sets (introduced in Version 1.6) now have a clear add method, `add_mutable_set*`, since the set reference should not expire [#200][] 251 * Mutating sets (introduced in Version 1.6) now have a clear add method, `add_mutable_set*`, since the set reference should not expire [#200][]
251 -* Subcommands now track how many times they were parsed in a parsing process. `count()` with no arguments will return the number of times a subcommand was encountered. [#179][]  
252 -* Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and `requirements`; all subcommands complete a phase before moving on. [#179][]  
253 -* Calling parse multiple times is now officially supported without `clear` (automatic). [#179][] 252 +* Subcommands now track how many times they were parsed in a parsing process. `count()` with no arguments will return the number of times a subcommand was encountered. [#178][]
  253 +* Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and `requirements`; all subcommands complete a phase before moving on. [#178][]
  254 +* Calling parse multiple times is now officially supported without `clear` (automatic). [#178][]
254 * Dropped the mostly undocumented `short_circuit` property, as help flag parsing is a bit more complex, and the default callback behavior of options now works properly. [#179][] 255 * Dropped the mostly undocumented `short_circuit` property, as help flag parsing is a bit more complex, and the default callback behavior of options now works properly. [#179][]
255 * Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][] 256 * Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][]
256 * Cleanup warnings [#191][] 257 * Cleanup warnings [#191][]
@@ -262,7 +263,7 @@ Passing the same subcommand multiple times is better supported. Several new feat @@ -262,7 +263,7 @@ Passing the same subcommand multiple times is better supported. Several new feat
262 > * `->add_set*` becomes `->add_mutable_set*` if you were using the editable set feature 263 > * `->add_set*` becomes `->add_mutable_set*` if you were using the editable set feature
263 > * `footer`, `name`, `callback`, and `type_name` must be used instead of the `set_*` versions (deprecated previously). 264 > * `footer`, `name`, `callback`, and `type_name` must be used instead of the `set_*` versions (deprecated previously).
264 265
265 -[#179]: https://github.com/CLIUtils/CLI11/pull/179 266 +[#178]: https://github.com/CLIUtils/CLI11/pull/178
266 [#183]: https://github.com/CLIUtils/CLI11/pull/183 267 [#183]: https://github.com/CLIUtils/CLI11/pull/183
267 [#185]: https://github.com/CLIUtils/CLI11/pull/185 268 [#185]: https://github.com/CLIUtils/CLI11/pull/185
268 [#186]: https://github.com/CLIUtils/CLI11/pull/186 269 [#186]: https://github.com/CLIUtils/CLI11/pull/186
@@ -315,7 +316,7 @@ New for Config file reading and writing [#121][]: @@ -315,7 +316,7 @@ New for Config file reading and writing [#121][]:
315 * Has `config_formatter()` and `get_config_formatter()`. 316 * Has `config_formatter()` and `get_config_formatter()`.
316 * Dropped prefix argument from `config_to_str`. 317 * Dropped prefix argument from `config_to_str`.
317 * Added `ConfigItem`. 318 * Added `ConfigItem`.
318 -* Added an example of a custom config format using [nlohmann/json]. [#138] 319 +* Added an example of a custom config format using [nlohmann/json][]. [#138][]
319 320
320 Validators are now much more powerful [#118][], all built in validators upgraded to the new form: 321 Validators are now much more powerful [#118][], all built in validators upgraded to the new form:
321 322
@@ -361,7 +362,7 @@ Backend and testing changes: @@ -361,7 +362,7 @@ Backend and testing changes:
361 [#120]: https://github.com/CLIUtils/CLI11/pull/120 362 [#120]: https://github.com/CLIUtils/CLI11/pull/120
362 [#121]: https://github.com/CLIUtils/CLI11/pull/121 363 [#121]: https://github.com/CLIUtils/CLI11/pull/121
363 [#126]: https://github.com/CLIUtils/CLI11/pull/126 364 [#126]: https://github.com/CLIUtils/CLI11/pull/126
364 -[#127]: https://github.com/CLIUtils/CLI11/pull/127 365 +[#136]: https://github.com/CLIUtils/CLI11/pull/136
365 [#138]: https://github.com/CLIUtils/CLI11/pull/138 366 [#138]: https://github.com/CLIUtils/CLI11/pull/138
366 [#140]: https://github.com/CLIUtils/CLI11/pull/140 367 [#140]: https://github.com/CLIUtils/CLI11/pull/140
367 [#141]: https://github.com/CLIUtils/CLI11/pull/141 368 [#141]: https://github.com/CLIUtils/CLI11/pull/141
@@ -429,8 +430,8 @@ Other, non-user facing changes: @@ -429,8 +430,8 @@ Other, non-user facing changes:
429 * Informational printout now added to CTest [#95][] 430 * Informational printout now added to CTest [#95][]
430 * Better single file generation [#95][] 431 * Better single file generation [#95][]
431 * Added support for GTest on MSVC 2017 (but not in C++17 mode, will need next version of GTest) 432 * Added support for GTest on MSVC 2017 (but not in C++17 mode, will need next version of GTest)
432 -* Types now have a specific size, separate from the expected number - cleaner and more powerful internally [#92]  
433 -* Examples now run as part of testing [#99] 433 +* Types now have a specific size, separate from the expected number - cleaner and more powerful internally [#92][]
  434 +* Examples now run as part of testing [#99][]
434 435
435 [#64]: https://github.com/CLIUtils/CLI11/issues/64 436 [#64]: https://github.com/CLIUtils/CLI11/issues/64
436 [#90]: https://github.com/CLIUtils/CLI11/issues/90 437 [#90]: https://github.com/CLIUtils/CLI11/issues/90
@@ -473,7 +474,7 @@ This version fixes the optional search in the single file version; some macros w @@ -473,7 +474,7 @@ This version fixes the optional search in the single file version; some macros w
473 474
474 This version adds lots of smaller fixes and additions after the refactor in version 1.3. More ways to download and use CLI11 in CMake have been added. INI files have improved support. 475 This version adds lots of smaller fixes and additions after the refactor in version 1.3. More ways to download and use CLI11 in CMake have been added. INI files have improved support.
475 476
476 -* Lexical cast is now more strict than before [#68] and fails on overflow [#84][] 477 +* Lexical cast is now more strict than before [#68][] and fails on overflow [#84][]
477 * Added `get_parent()` to access the parent from a subcommand 478 * Added `get_parent()` to access the parent from a subcommand
478 * Added `ExistingPath` validator [#73][] 479 * Added `ExistingPath` validator [#73][]
479 * `app.allow_ini_extras()` added to allow extras in INI files [#70][] 480 * `app.allow_ini_extras()` added to allow extras in INI files [#70][]
README.md
@@ -355,7 +355,7 @@ Before parsing, you can set the following options: @@ -355,7 +355,7 @@ Before parsing, you can set the following options:
355 * `->transform(Validator)`: Uses a Validator object to do the transformation see [Validators](#validators) for a description of available Validators and how to create new ones. 355 * `->transform(Validator)`: Uses a Validator object to do the transformation see [Validators](#validators) for a description of available Validators and how to create new ones.
356 * `->each(void(const std::string &)>`: Run this function on each value received, as it is received. It should throw a `ValidationError` if an error is encountered. 356 * `->each(void(const std::string &)>`: Run this function on each value received, as it is received. It should throw a `ValidationError` if an error is encountered.
357 * `->configurable(false)`: Disable this option from being in a configuration file. 357 * `->configurable(false)`: Disable this option from being in a configuration file.
358 -* `->capture_default_str()`: Store the current value attached and display it in the help string. 358 +* `->capture_default_str()`: Store the current value attached and display it in the help string.
359 * `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses. 359 * `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses.
360 * `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`. 360 * `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`.
361 * `->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. 361 * `->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.
@@ -384,7 +384,7 @@ If `allow_windows_style_options()` is specified in the application or subcommand @@ -384,7 +384,7 @@ If `allow_windows_style_options()` is specified in the application or subcommand
384 * `/file filename` (space) 384 * `/file filename` (space)
385 * `/file:filename` (colon) 385 * `/file:filename` (colon)
386 * `/long_flag:false` (long flag with : to override the default value) 386 * `/long_flag:false` (long flag with : to override the default value)
387 - * Windows style options do not allow combining short options or values not separated from the short option like with `-` options 387 + * Windows style options do not allow combining short options or values not separated from the short option like with `-` options
388 388
389 Long flag options may be given with an `=<value>` to allow specifying a false value, or some other value to the flag. See [config files](#configuration-file) for details on the values supported. NOTE: only the `=` or `:` for windows-style options may be used for this, using a space will result in the argument being interpreted as a positional argument. This syntax can override the default values, and can be disabled by using `disable_flag_override()`. 389 Long flag options may be given with an `=<value>` to allow specifying a false value, or some other value to the flag. See [config files](#configuration-file) for details on the values supported. NOTE: only the `=` or `:` for windows-style options may be used for this, using a space will result in the argument being interpreted as a positional argument. This syntax can override the default values, and can be disabled by using `disable_flag_override()`.
390 390
@@ -729,7 +729,7 @@ app.set_config(option_name=&quot;&quot;, @@ -729,7 +729,7 @@ app.set_config(option_name=&quot;&quot;,
729 required=false) 729 required=false)
730 ``` 730 ```
731 731
732 -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: 732 +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:
733 733
734 ```toml 734 ```toml
735 # Comments are supported, using a # 735 # Comments are supported, using a #
@@ -1064,3 +1064,4 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi @@ -1064,3 +1064,4 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi
1064 [hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html 1064 [hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html
1065 [standard readme style]: https://github.com/RichardLitt/standard-readme 1065 [standard readme style]: https://github.com/RichardLitt/standard-readme
1066 [argparse]: https://github.com/p-ranav/argparse 1066 [argparse]: https://github.com/p-ranav/argparse
  1067 +[toml]: https://toml.io
book/README.md
1 # CLI11: An introduction 1 # CLI11: An introduction
2 2
3 -This gitbook is designed to provide an introduction to using the CLI11 library to write your own command line programs. The library is designed to be clean, intuitive, but powerful. There are no requirements beyond C++11 support (and even `<regex>` support not required). It works on Mac, Linux, and Windows, and has 100% test coverage on all three systems. You can simply drop in a single header file (`CLI11.hpp` available in [releases]) to use CLI11 in your own application. Other ways to integrate it into a build system are listed in the [README][]. 3 +This gitbook is designed to provide an introduction to using the CLI11 library to write your own command line programs. The library is designed to be clean, intuitive, but powerful. There are no requirements beyond C++11 support (and even `<regex>` support not required). It works on Mac, Linux, and Windows, and has 100% test coverage on all three systems. You can simply drop in a single header file (`CLI11.hpp` available in [releases][]) to use CLI11 in your own application. Other ways to integrate it into a build system are listed in the [README][].
4 4
5 The library was inspired the Python libraries [Plumbum][] and [Click][], and incorporates many of their user friendly features. The library is extensively documented, with a [friendly introduction][README], this tutorial book, and more technical [API docs][]. 5 The library was inspired the Python libraries [Plumbum][] and [Click][], and incorporates many of their user friendly features. The library is extensively documented, with a [friendly introduction][README], this tutorial book, and more technical [API docs][].
6 6
@@ -51,16 +51,15 @@ You can use subcommands, as well. Subcommands support callback lambda functions @@ -51,16 +51,15 @@ You can use subcommands, as well. Subcommands support callback lambda functions
51 51
52 Reading/producing `.ini` files for configuration is also supported, as is using environment variables as input. The base `App` can be subclassed and customized for use in a toolkit (like [GooFit][]). All the standard shell idioms, like `--`, work as well. 52 Reading/producing `.ini` files for configuration is also supported, as is using environment variables as input. The base `App` can be subclassed and customized for use in a toolkit (like [GooFit][]). All the standard shell idioms, like `--`, work as well.
53 53
54 -CLI11 was developed at the [University of Cincinnati] in support of the [GooFit][] library under [NSF Award 1414736][NSF 1414736]. It was featured in a [DIANA/HEP][] meeting at CERN. Please give it a try! Feedback is always welcome. 54 +CLI11 was developed at the [University of Cincinnati][] in support of the [GooFit][] library under [NSF Award 1414736][NSF 1414736]. It was featured in a [DIANA/HEP][] meeting at CERN. Please give it a try! Feedback is always welcome.
55 55
56 [goofit]: https://github.com/GooFit/GooFit 56 [goofit]: https://github.com/GooFit/GooFit
57 -[diana/hep]: http://diana-hep.org  
58 -[cli11]: https://github.com/CLIUtils/CLI11 57 +[diana/hep]: https://diana-hep.org
59 [cli11tutoriaL]: https://cliutils.github.io/CLI11/book 58 [cli11tutoriaL]: https://cliutils.github.io/CLI11/book
60 [releases]: https://github.com/CLIUtils/CLI11/releases 59 [releases]: https://github.com/CLIUtils/CLI11/releases
61 [api docs]: https://cliutils.github.io/CLI11 60 [api docs]: https://cliutils.github.io/CLI11
62 [readme]: https://github.com/CLIUtils/CLI11/blob/master/README.md 61 [readme]: https://github.com/CLIUtils/CLI11/blob/master/README.md
63 [nsf 1414736]: https://nsf.gov/awardsearch/showAward?AWD_ID=1414736 62 [nsf 1414736]: https://nsf.gov/awardsearch/showAward?AWD_ID=1414736
64 -[university of cincinnati]: http://www.uc.edu  
65 -[plumbum]: http://plumbum.readthedocs.io/en/latest/  
66 -[click]: https://click.palletsprojects.com/ 63 +[university of cincinnati]: https://www.uc.edu
  64 +[plumbum]: https://plumbum.readthedocs.io/en/latest/
  65 +[click]: https://click.palletsprojects.com
book/chapters/config.md
@@ -176,7 +176,7 @@ See [`examples/json.cpp`](https://github.com/CLIUtils/CLI11/blob/master/examples @@ -176,7 +176,7 @@ See [`examples/json.cpp`](https://github.com/CLIUtils/CLI11/blob/master/examples
176 176
177 ## Triggering Subcommands 177 ## Triggering Subcommands
178 178
179 -Configuration files can be used to trigger subcommands if a subcommand is set to configure. By default configuration file just set the default values of a subcommand. But if the `configure()` option is set on a subcommand then the if the subcommand is utilized via a `[subname]` block in the configuration file it will act as if it were called from the command line. Subsubcommands can be triggered via [subname.subsubname]. Using the `[[subname]]` will be as if the subcommand were triggered multiple times from the command line. This functionality can allow the configuration file to act as a scripting file. 179 +Configuration files can be used to trigger subcommands if a subcommand is set to configure. By default configuration file just set the default values of a subcommand. But if the `configure()` option is set on a subcommand then the if the subcommand is utilized via a `[subname]` block in the configuration file it will act as if it were called from the command line. Subsubcommands can be triggered via `[subname.subsubname]`. Using the `[[subname]]` will be as if the subcommand were triggered multiple times from the command line. This functionality can allow the configuration file to act as a scripting file.
180 180
181 For custom configuration files this behavior can be triggered by specifying the parent subcommands in the structure and `++` as the name to open a new subcommand scope and `--` to close it. These names trigger the different callbacks of configurable subcommands. 181 For custom configuration files this behavior can be triggered by specifying the parent subcommands in the structure and `++` as the name to open a new subcommand scope and `--` to close it. These names trigger the different callbacks of configurable subcommands.
182 182