Skip to content

Commit 2ea663b

Browse files
committed
style: add remarklint
1 parent 4698131 commit 2ea663b

File tree

6 files changed

+39
-21
lines changed

6 files changed

+39
-21
lines changed

.pre-commit-config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ repos:
4747
- id: markdownlint
4848
args: ["--style=scripts/mdlint_style.rb"]
4949

50+
- repo: local
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+
5060
- repo: local
5161
hooks:
5262
- id: disallow-caps

.remarkrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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

+11-10
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ configuration options were added to facilitate a wider variety of apps. GCC
149149
[#373]: https://github.com/CLIUtils/CLI11/pull/373
150150
[#374]: https://github.com/CLIUtils/CLI11/pull/374
151151
[#382]: https://github.com/CLIUtils/CLI11/pull/382
152+
[#387]: https://github.com/CLIUtils/CLI11/pull/387
152153
[#390]: https://github.com/CLIUtils/CLI11/pull/390
153154
[#394]: https://github.com/CLIUtils/CLI11/pull/394
154155
[#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
187188
* Support for composable unnamed subcommands [#216][]
188189
* Reparsing is better supported with `.remaining_for_passthrough()` [#265][]
189190
* 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][]
191192
* Minimum required Boost for optional Optionals has been corrected to 1.61 [#226][]
192193
* Positionals can stop options from being parsed with `app.positionals_at_end()` [#223][]
193194
* Added `validate_positionals` [#262][]
@@ -248,9 +249,9 @@ Passing the same subcommand multiple times is better supported. Several new feat
248249
* The default message now will mention the help-all flag also if present [#197][]
249250
* Added `->description` to set Option descriptions [#199][]
250251
* 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][]
254255
* 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][]
255256
* Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][]
256257
* Cleanup warnings [#191][]
@@ -262,7 +263,7 @@ Passing the same subcommand multiple times is better supported. Several new feat
262263
> * `->add_set*` becomes `->add_mutable_set*` if you were using the editable set feature
263264
> * `footer`, `name`, `callback`, and `type_name` must be used instead of the `set_*` versions (deprecated previously).
264265
265-
[#179]: https://github.com/CLIUtils/CLI11/pull/179
266+
[#178]: https://github.com/CLIUtils/CLI11/pull/178
266267
[#183]: https://github.com/CLIUtils/CLI11/pull/183
267268
[#185]: https://github.com/CLIUtils/CLI11/pull/185
268269
[#186]: https://github.com/CLIUtils/CLI11/pull/186
@@ -315,7 +316,7 @@ New for Config file reading and writing [#121][]:
315316
* Has `config_formatter()` and `get_config_formatter()`.
316317
* Dropped prefix argument from `config_to_str`.
317318
* 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][]
319320

320321
Validators are now much more powerful [#118][], all built in validators upgraded to the new form:
321322

@@ -361,7 +362,7 @@ Backend and testing changes:
361362
[#120]: https://github.com/CLIUtils/CLI11/pull/120
362363
[#121]: https://github.com/CLIUtils/CLI11/pull/121
363364
[#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
365366
[#138]: https://github.com/CLIUtils/CLI11/pull/138
366367
[#140]: https://github.com/CLIUtils/CLI11/pull/140
367368
[#141]: https://github.com/CLIUtils/CLI11/pull/141
@@ -429,8 +430,8 @@ Other, non-user facing changes:
429430
* Informational printout now added to CTest [#95][]
430431
* Better single file generation [#95][]
431432
* 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][]
434435

435436
[#64]: https://github.com/CLIUtils/CLI11/issues/64
436437
[#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
473474

474475
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.
475476

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][]
477478
* Added `get_parent()` to access the parent from a subcommand
478479
* Added `ExistingPath` validator [#73][]
479480
* `app.allow_ini_extras()` added to allow extras in INI files [#70][]

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Before parsing, you can set the following options:
355355
* `->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.
356356
* `->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.
357357
* `->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.
359359
* `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses.
360360
* `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`.
361361
* `->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
384384
* `/file filename` (space)
385385
* `/file:filename` (colon)
386386
* `/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
388388

389389
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()`.
390390

@@ -729,7 +729,7 @@ app.set_config(option_name="",
729729
required=false)
730730
```
731731

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:
733733

734734
```toml
735735
# Comments are supported, using a #
@@ -1064,3 +1064,4 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi
10641064
[hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html
10651065
[standard readme style]: https://github.com/RichardLitt/standard-readme
10661066
[argparse]: https://github.com/p-ranav/argparse
1067+
[toml]: https://toml.io

book/README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CLI11: An introduction
22

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][].
44

55
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][].
66

@@ -51,16 +51,15 @@ You can use subcommands, as well. Subcommands support callback lambda functions
5151
5252
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.
5353
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.
5555
5656
[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
5958
[cli11tutoriaL]: https://cliutils.github.io/CLI11/book
6059
[releases]: https://github.com/CLIUtils/CLI11/releases
6160
[api docs]: https://cliutils.github.io/CLI11
6261
[readme]: https://github.com/CLIUtils/CLI11/blob/master/README.md
6362
[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

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ See [`examples/json.cpp`](https://github.com/CLIUtils/CLI11/blob/master/examples
176176

177177
## Triggering Subcommands
178178

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.
180180

181181
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.
182182

0 commit comments

Comments
 (0)