mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 12:13:52 +00:00
style: add remarklint
This commit is contained in:
parent
4698131216
commit
2ea663bcc7
@ -47,6 +47,16 @@ repos:
|
||||
- id: markdownlint
|
||||
args: ["--style=scripts/mdlint_style.rb"]
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: remarklint
|
||||
name: remarklint
|
||||
language: node
|
||||
entry: remark
|
||||
types: [markdown]
|
||||
args: ["--frail", "--quiet"]
|
||||
additional_dependencies: [remark, remark-lint, remark-cli, remark-preset-lint-recommended, remark-lint-list-item-indent, remark-lint-no-undefined-references]
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: disallow-caps
|
||||
|
7
.remarkrc
Normal file
7
.remarkrc
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"remark-preset-lint-recommended",
|
||||
["remark-lint-list-item-indent", "space"],
|
||||
["remark-lint-no-undefined-references", {"allow": ["^1"]}]
|
||||
]
|
||||
}
|
21
CHANGELOG.md
21
CHANGELOG.md
@ -149,6 +149,7 @@ configuration options were added to facilitate a wider variety of apps. GCC
|
||||
[#373]: https://github.com/CLIUtils/CLI11/pull/373
|
||||
[#374]: https://github.com/CLIUtils/CLI11/pull/374
|
||||
[#382]: https://github.com/CLIUtils/CLI11/pull/382
|
||||
[#387]: https://github.com/CLIUtils/CLI11/pull/387
|
||||
[#390]: https://github.com/CLIUtils/CLI11/pull/390
|
||||
[#394]: https://github.com/CLIUtils/CLI11/pull/394
|
||||
[#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
|
||||
* Support for composable unnamed subcommands [#216][]
|
||||
* Reparsing is better supported with `.remaining_for_passthrough()` [#265][]
|
||||
* Custom vector separator using `->delimiter(char)` [#209][], [#221][], [#240][]
|
||||
* Validators added for IP4 addresses and positive numbers [#210] and numbers [#262][]
|
||||
* Validators added for IP4 addresses and positive numbers [#210][] and numbers [#262][]
|
||||
* Minimum required Boost for optional Optionals has been corrected to 1.61 [#226][]
|
||||
* Positionals can stop options from being parsed with `app.positionals_at_end()` [#223][]
|
||||
* Added `validate_positionals` [#262][]
|
||||
@ -248,9 +249,9 @@ Passing the same subcommand multiple times is better supported. Several new feat
|
||||
* The default message now will mention the help-all flag also if present [#197][]
|
||||
* Added `->description` to set Option descriptions [#199][]
|
||||
* Mutating sets (introduced in Version 1.6) now have a clear add method, `add_mutable_set*`, since the set reference should not expire [#200][]
|
||||
* 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][]
|
||||
* Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and `requirements`; all subcommands complete a phase before moving on. [#179][]
|
||||
* Calling parse multiple times is now officially supported without `clear` (automatic). [#179][]
|
||||
* 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][]
|
||||
* Parsing is now done in phases: `shortcurcuits`, `ini`, `env`, `callbacks`, and `requirements`; all subcommands complete a phase before moving on. [#178][]
|
||||
* Calling parse multiple times is now officially supported without `clear` (automatic). [#178][]
|
||||
* 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][]
|
||||
* Use the standard `BUILD_TESTING` over `CLI11_TESTING` if defined [#183][]
|
||||
* Cleanup warnings [#191][]
|
||||
@ -262,7 +263,7 @@ Passing the same subcommand multiple times is better supported. Several new feat
|
||||
> * `->add_set*` becomes `->add_mutable_set*` if you were using the editable set feature
|
||||
> * `footer`, `name`, `callback`, and `type_name` must be used instead of the `set_*` versions (deprecated previously).
|
||||
|
||||
[#179]: https://github.com/CLIUtils/CLI11/pull/179
|
||||
[#178]: https://github.com/CLIUtils/CLI11/pull/178
|
||||
[#183]: https://github.com/CLIUtils/CLI11/pull/183
|
||||
[#185]: https://github.com/CLIUtils/CLI11/pull/185
|
||||
[#186]: https://github.com/CLIUtils/CLI11/pull/186
|
||||
@ -315,7 +316,7 @@ New for Config file reading and writing [#121][]:
|
||||
* Has `config_formatter()` and `get_config_formatter()`.
|
||||
* Dropped prefix argument from `config_to_str`.
|
||||
* Added `ConfigItem`.
|
||||
* Added an example of a custom config format using [nlohmann/json]. [#138]
|
||||
* Added an example of a custom config format using [nlohmann/json][]. [#138][]
|
||||
|
||||
Validators are now much more powerful [#118][], all built in validators upgraded to the new form:
|
||||
|
||||
@ -361,7 +362,7 @@ Backend and testing changes:
|
||||
[#120]: https://github.com/CLIUtils/CLI11/pull/120
|
||||
[#121]: https://github.com/CLIUtils/CLI11/pull/121
|
||||
[#126]: https://github.com/CLIUtils/CLI11/pull/126
|
||||
[#127]: https://github.com/CLIUtils/CLI11/pull/127
|
||||
[#136]: https://github.com/CLIUtils/CLI11/pull/136
|
||||
[#138]: https://github.com/CLIUtils/CLI11/pull/138
|
||||
[#140]: https://github.com/CLIUtils/CLI11/pull/140
|
||||
[#141]: https://github.com/CLIUtils/CLI11/pull/141
|
||||
@ -429,8 +430,8 @@ Other, non-user facing changes:
|
||||
* Informational printout now added to CTest [#95][]
|
||||
* Better single file generation [#95][]
|
||||
* Added support for GTest on MSVC 2017 (but not in C++17 mode, will need next version of GTest)
|
||||
* Types now have a specific size, separate from the expected number - cleaner and more powerful internally [#92]
|
||||
* Examples now run as part of testing [#99]
|
||||
* Types now have a specific size, separate from the expected number - cleaner and more powerful internally [#92][]
|
||||
* Examples now run as part of testing [#99][]
|
||||
|
||||
[#64]: https://github.com/CLIUtils/CLI11/issues/64
|
||||
[#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
|
||||
|
||||
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.
|
||||
|
||||
* Lexical cast is now more strict than before [#68] and fails on overflow [#84][]
|
||||
* Lexical cast is now more strict than before [#68][] and fails on overflow [#84][]
|
||||
* Added `get_parent()` to access the parent from a subcommand
|
||||
* Added `ExistingPath` validator [#73][]
|
||||
* `app.allow_ini_extras()` added to allow extras in INI files [#70][]
|
||||
|
@ -355,7 +355,7 @@ Before parsing, you can set the following options:
|
||||
* `->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.
|
||||
* `->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.
|
||||
* `->configurable(false)`: Disable this option from being in a configuration file.
|
||||
* `->capture_default_str()`: Store the current value attached and display it in the help string.
|
||||
* `->capture_default_str()`: Store the current value attached and display it in the help string.
|
||||
* `->default_function(std::string())`: Advanced: Change the function that `capture_default_str()` uses.
|
||||
* `->always_capture_default()`: Always run `capture_default_str()` when creating new options. Only useful on an App's `option_defaults`.
|
||||
* `->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
|
||||
* `/file filename` (space)
|
||||
* `/file:filename` (colon)
|
||||
* `/long_flag:false` (long flag with : to override the default value)
|
||||
* Windows style options do not allow combining short options or values not separated from the short option like with `-` options
|
||||
* Windows style options do not allow combining short options or values not separated from the short option like with `-` options
|
||||
|
||||
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()`.
|
||||
|
||||
@ -729,7 +729,7 @@ app.set_config(option_name="",
|
||||
required=false)
|
||||
```
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
```toml
|
||||
# Comments are supported, using a #
|
||||
@ -1064,3 +1064,4 @@ CLI11 was developed at the [University of Cincinnati][] to support of the [GooFi
|
||||
[hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html
|
||||
[standard readme style]: https://github.com/RichardLitt/standard-readme
|
||||
[argparse]: https://github.com/p-ranav/argparse
|
||||
[toml]: https://toml.io
|
||||
|
@ -1,6 +1,6 @@
|
||||
# CLI11: An introduction
|
||||
|
||||
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][].
|
||||
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][].
|
||||
|
||||
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][].
|
||||
|
||||
@ -51,16 +51,15 @@ You can use subcommands, as well. Subcommands support callback lambda functions
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
[goofit]: https://github.com/GooFit/GooFit
|
||||
[diana/hep]: http://diana-hep.org
|
||||
[cli11]: https://github.com/CLIUtils/CLI11
|
||||
[diana/hep]: https://diana-hep.org
|
||||
[cli11tutoriaL]: https://cliutils.github.io/CLI11/book
|
||||
[releases]: https://github.com/CLIUtils/CLI11/releases
|
||||
[api docs]: https://cliutils.github.io/CLI11
|
||||
[readme]: https://github.com/CLIUtils/CLI11/blob/master/README.md
|
||||
[nsf 1414736]: https://nsf.gov/awardsearch/showAward?AWD_ID=1414736
|
||||
[university of cincinnati]: http://www.uc.edu
|
||||
[plumbum]: http://plumbum.readthedocs.io/en/latest/
|
||||
[click]: https://click.palletsprojects.com/
|
||||
[university of cincinnati]: https://www.uc.edu
|
||||
[plumbum]: https://plumbum.readthedocs.io/en/latest/
|
||||
[click]: https://click.palletsprojects.com
|
||||
|
@ -176,7 +176,7 @@ See [`examples/json.cpp`](https://github.com/CLIUtils/CLI11/blob/master/examples
|
||||
|
||||
## Triggering Subcommands
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user