• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

CLI/H04-Nov-2021-9,3396,584

LICENSEH A D04-Nov-20211.5 KiB2622

README.kitware.mdH A D04-Nov-2021238 96

README.mdH A D04-Nov-202197.6 KiB1,050826

README.kitware.md

1# CLI11 fork for VTK
2
3This branch contains changes required to embed CLI11 in VTK.
4
5* Ignore whitespace for VTK's commit checks
6* Update CMakeLists.vtk.txt to include build/install rules for
7  VTK's module system.
8* Mangle CLI namespace.
9

README.md

1# CLI11: Command line parser for C++11
2
3![CLI11 Logo](./docs/CLI11_300.png)
4
5[![Build Status Linux and macOS][travis-badge]][travis]
6[![Build Status Windows][appveyor-badge]][appveyor]
7[![Build Status Azure][azure-badge]][azure]
8[![Actions Status][actions-badge]][actions-link]
9[![Code Coverage][codecov-badge]][codecov]
10[![Codacy Badge][codacy-badge]][codacy-link]
11[![Join the chat at https://gitter.im/CLI11gitter/Lobby][gitter-badge]][gitter]
12[![License: BSD][license-badge]](./LICENSE)
13[![Latest release][releases-badge]][github releases]
14[![DOI][doi-badge]][doi-link]
15[![Conan.io][conan-badge]][conan-link]
16[![Try CLI11 1.9 online][wandbox-badge]][wandbox-link]
17
18[What's new](./CHANGELOG.md) •
19[Documentation][gitbook] •
20[API Reference][api-docs]
21
22CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface.
23
24## Table of Contents
25
26-   [Background](#background)
27    -   [Introduction](#introduction)
28    -   [Why write another CLI parser?](#why-write-another-cli-parser)
29    -   [Other parsers](#other-parsers)
30    -   [Features not supported by this library](#features-not-supported-by-this-library)
31-   [Install](#install)
32-   [Usage](#usage)
33    -   [Adding options](#adding-options)
34        -   [Option types](#option-types)
35        -   [Example](#example)
36        -   [Option options](#option-options)
37        -   [Validators](#validators)
38            -   [Transforming Validators](#transforming-validators)
39            -   [Validator operations](#validator-operations)
40            -   [Custom Validators](#custom-validators)
41            -   [Querying Validators](#querying-validators)
42        -   [Getting Results](#getting-results)
43    -   [Subcommands](#subcommands)
44        -   [Subcommand options](#subcommand-options)
45        -   [Option groups](#option-groups)
46        -   [Callbacks](#callbacks)
47    -   [Configuration file](#configuration-file)
48    -   [Inheriting defaults](#inheriting-defaults)
49    -   [Formatting](#formatting)
50    -   [Subclassing](#subclassing)
51    -   [How it works](#how-it-works)
52    -   [Utilities](#utilities)
53    -   [Other libraries](#other-libraries)
54-   [API](#api)
55-   [Examples](#Examples)
56-   [Contribute](#contribute)
57-   [License](#license)
58
59Features that were added in the last released major version are marked with "��". Features only available in master are marked with "��".
60
61## Background
62
63### Introduction
64
65CLI11 provides all the features you expect in a powerful command line parser, with a beautiful, minimal syntax and no dependencies beyond C++11. It is header only, and comes in a single file form for easy inclusion in projects. It is easy to use for small projects, but powerful enough for complex command line projects, and can be customized for frameworks.
66It is tested on [Travis][], [AppVeyor][], [Azure][], and [GitHub Actions][actions-link], and is used by the [GooFit GPU fitting framework][goofit]. It was inspired by [`plumbum.cli`][plumbum] for Python. CLI11 has a user friendly introduction in this README, a more in-depth tutorial [GitBook][], as well as [API documentation][api-docs] generated by Travis.
67See the [changelog](./CHANGELOG.md) or [GitHub Releases][] for details for current and past releases. Also see the [Version 1.0 post][], [Version 1.3 post][], or [Version 1.6 post][] for more information.
68
69You can be notified when new releases are made by subscribing to <https://github.com/CLIUtils/CLI11/releases.atom> on an RSS reader, like Feedly, or use the releases mode of the GitHub watching tool.
70
71### Why write another CLI parser?
72
73An acceptable CLI parser library should be all of the following:
74
75-   Easy to include (i.e., header only, one file if possible, **no external requirements**).
76-   Short, simple syntax: This is one of the main reasons to use a CLI parser, it should make variables from the command line nearly as easy to define as any other variables. If most of your program is hidden in CLI parsing, this is a problem for readability.
77-   C++11 or better: Should work with GCC 4.8+ (default on CentOS/RHEL 7), Clang 3.4+, AppleClang 7+, NVCC 7.0+, or MSVC 2015+.
78-   Work on Linux, macOS, and Windows.
79-   Well tested using [Travis][] (Linux) and [AppVeyor][] (Windows) or [Azure][] (all three). "Well" is defined as having good coverage measured by [CodeCov][].
80-   Clear help printing.
81-   Nice error messages.
82-   Standard shell idioms supported naturally, like grouping flags, a positional separator, etc.
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.
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 (`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.
88-   Work with standard types, simple custom types, and extensible to exotic types.
89-   Permissively licensed.
90
91### Other parsers
92
93<details><summary>The major CLI parsers for C++ include, with my biased opinions: (click to expand)</summary><p>
94
95| Library                             | My biased opinion                                                                                                                                                                                                                                                                                                                                                                                                                  |
96| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
97| [Boost Program Options][]           | A great library if you already depend on Boost, but its pre-C++11 syntax is really odd and setting up the correct call in the main function is poorly documented (and is nearly a page of code). A simple wrapper for the Boost library was originally developed, but was discarded as CLI11 became more powerful. The idea of capturing a value and setting it originated with Boost PO. [See this comparison.][cli11-po-compare] |
98| [The Lean Mean C++ Option Parser][] | One header file is great, but the syntax is atrocious, in my opinion. It was quite impractical to wrap the syntax or to use in a complex project. It seems to handle standard parsing quite well.                                                                                                                                                                                                                                  |
99| [TCLAP][]                           | The not-quite-standard command line parsing causes common shortcuts to fail. It also seems to be poorly supported, with only minimal bugfixes accepted. Header only, but in quite a few files. Has not managed to get enough support to move to GitHub yet. No subcommands. Produces wrapped values.                                                                                                                               |
100| [Cxxopts][]                         | C++11, single file, and nice CMake support, but requires regex, therefore GCC 4.8 (CentOS 7 default) does not work. Syntax closely based on Boost PO, so not ideal but familiar.                                                                                                                                                                                                                                                   |
101| [DocOpt][]                          | Completely different approach to program options in C++11, you write the docs and the interface is generated. Too fragile and specialized.                                                                                                                                                                                                                                                                                         |
102
103After I wrote this, I also found the following libraries:
104
105| Library                 | My biased opinion                                                                                                                                                                    |
106| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
107| [GFlags][]              | The Google Commandline Flags library. Uses macros heavily, and is limited in scope, missing things like subcommands. It provides a simple syntax and supports config files/env vars. |
108| [GetOpt][]              | Very limited C solution with long, convoluted syntax. Does not support much of anything, like help generation. Always available on UNIX, though (but in different flavors).          |
109| [ProgramOptions.hxx][]  | Interesting library, less powerful and no subcommands. Nice callback system.                                                                                                         |
110| [Args][]                | Also interesting, and supports subcommands. I like the optional-like design, but CLI11 is cleaner and provides direct value access, and is less verbose.                             |
111| [Argument Aggregator][] | I'm a big fan of the [fmt][] library, and the try-catch statement looks familiar.  :thumbsup: Doesn't seem to support subcommands.                                                   |
112| [Clara][]               | Simple library built for the excellent [Catch][] testing framework. Unique syntax, limited scope.                                                                                    |
113| [Argh!][]               | Very minimalistic C++11 parser, single header. Don't have many features. No help generation?!?! At least it's exception-free.                                                        |
114| [CLI][]                 | Custom language and parser. Huge build-system overkill for very little benefit. Last release in 2009, but still occasionally active.                                                 |
115| [argparse][]            | C++17 single file argument parser. Design seems similar to CLI11 in some ways. The author has several other interesting projects.                                                    |
116
117See [Awesome C++][] for a less-biased list of parsers. You can also find other single file libraries at [Single file libs][].
118
119</p></details>
120<br/>
121
122None of these libraries fulfill all the above requirements, or really even come close. As you probably have already guessed, CLI11 does.
123So, this library was designed to provide a great syntax, good compiler compatibility, and minimal installation fuss.
124
125### Features not supported by this library
126
127There are some other possible "features" that are intentionally not supported by this library:
128
129-   Non-standard variations on syntax, like `-long` options. This is non-standard and should be avoided, so that is enforced by this library.
130-   Completion of partial options, such as Python's `argparse` supplies for incomplete arguments. It's better not to guess. Most third party command line parsers for python actually reimplement command line parsing rather than using argparse because of this perceived design flaw.
131-   Autocomplete: This might eventually be added to both Plumbum and CLI11, but it is not supported yet.
132-   Wide strings / unicode: Since this uses the standard library only, it might be hard to properly implement, but I would be open to suggestions in how to do this.
133
134## Install
135
136To use, there are several methods:
137
1381.  All-in-one local header: Copy `CLI11.hpp` from the [most recent release][github releases] into your include directory, and you are set. This is combined from the source files  for every release. This includes the entire command parser library, but does not include separate utilities (like `Timer`, `AutoTimer`). The utilities are completely self contained and can be copied separately.
1392.  All-in-one global header: Like above, but copying the file to a shared folder location like `/opt/CLI11`. Then, the C++ include path has to be extended to point at this folder. With CMake, use `include_directories(/opt/CLI11)`
1403.  Local headers and target: Use `CLI/*.hpp` files. You could check out the repository as a git submodule, for example. With CMake, you can use `add_subdirectory` and the `CLI11::CLI11` interface target when linking. If not using a submodule, you must ensure that the copied files are located inside the same tree directory than your current project, to prevent an error with CMake and `add_subdirectory`.
1414.  Global headers: Use `CLI/*.hpp` files stored in a shared folder. You could check out the git repository in a system-wide folder, for example `/opt/`. With CMake, you could add to the include path via:
142```bash
143if(NOT DEFINED CLI11_DIR)
144set (CLI11_DIR "/opt/CLI11" CACHE STRING "CLI11 git repository")
145endif()
146include_directories(${CLI11_DIR}/include)
147```
148And then in the source code (adding several headers might be needed to prevent linker errors):
149```cpp
150#include "CLI/App.hpp"
151#include "CLI/Formatter.hpp"
152#include "CLI/Config.hpp"
153```
1545.  Global headers and target: configuring and installing the project is required for linking CLI11 to your project in the same way as you would do with any other external library. With CMake, this step allows using `find_package(CLI11 CONFIG REQUIRED)` and then using the `CLI11::CLI11` target when linking. If `CMAKE_INSTALL_PREFIX` was changed during install to a specific folder like `/opt/CLI11`, then you have to pass `-DCLI11_DIR=/opt/CLI11` when building your current project. You can also use [Conan.io][conan-link] or [Hunter][].
155    (These are just conveniences to allow you to use your favorite method of managing packages; it's just header only so including the correct path and
156    using C++11 is all you really need.)
157
158To build the tests, checkout the repository and use CMake:
159
160```bash
161mkdir build
162cd build
163cmake ..
164make
165GTEST_COLOR=1 CTEST_OUTPUT_ON_FAILURE=1 make test
166```
167
168<details><summary>Note: Special instructions for GCC 8</summary><p>
169
170If you are using GCC 8 and using it in C++17 mode with CLI11.  CLI11 makes use of the `<filesystem>` header if available, but specifically for this compiler, the `filesystem` library is separate from the standard library and needs to be linked separately. So it is available but CLI11 doesn't use it by default.
171
172Specifically `libstdc++fs` needs to be added to the linking list and `CLI11_HAS_FILESYSTEM=1` has to be defined.  Then the filesystem variant of the Validators could be used on GCC 8.  GCC 9+ does not have this issue so the `<filesystem>` is used by default.
173
174There may also be other cases where a specific library needs to be linked.
175
176Defining `CLI11_HAS_FILESYSTEM=0`  which will remove the usage and hence any linking issue.
177
178In some cases certain clang compilations may require linking against `libc++fs`.  These situations have not been encountered so the specific situations requiring them are unknown yet.
179
180</p></details>
181</br>
182
183## Usage
184
185### Adding options
186
187To set up, add options, and run, your main function will look something like this:
188
189```cpp
190int main(int argc, char** argv) {
191    CLI::App app{"App description"};
192
193    std::string filename = "default";
194    app.add_option("-f,--file", filename, "A help string");
195
196    CLI11_PARSE(app, argc, argv);
197    return 0;
198}
199```
200
201<details><summary>Note: If you don't like macros, this is what that macro expands to: (click to expand)</summary><p>
202
203```cpp
204try {
205    app.parse(argc, argv);
206} catch (const CLI::ParseError &e) {
207    return app.exit(e);
208}
209```
210
211The try/catch block ensures that `-h,--help` or a parse error will exit with the correct return code (selected from `CLI::ExitCodes`). (The return here should be inside `main`). You should not assume that the option values have been set inside the catch block; for example, help flags intentionally short-circuit all other processing for speed and to ensure required options and the like do not interfere.
212
213</p></details>
214</br>
215
216The initialization is just one line, adding options is just two each. The parse macro is just one line (or 5 for the contents of the macro).  After the app runs, the filename will be set to the correct value if it was passed, otherwise it will be set to the default. You can check to see if this was passed on the command line with `app.count("--file")`.
217
218#### Option types
219
220While all options internally are the same type, there are several ways to add an option depending on what you need. The supported values are:
221
222```cpp
223// Add options
224app.add_option(option_name, help_str="")
225
226app.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.
228               help_string="")
229
230app.add_option_function<type>(option_name,
231               function <void(const type &value)>, // type can be any type supported by add_option
232               help_string="")
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.
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
237app.add_option<typename T, typename XC>(option_name,
238               T &output, // output must be assignable or constructible from a value of type XC
239               help_string="")
240
241// Add flags
242app.add_flag(option_name,
243             help_string="")
244
245app.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
247             help_string="")
248
249app.add_flag_function(option_name,
250             function <void(std::int64_t count)>,
251             help_string="")
252
253app.add_flag_callback(option_name,function<void(void)>,help_string="")
254
255// Add subcommands
256App* subcom = app.add_subcommand(name, description);
257
258Option_group *app.add_option_group(name,description);
259```
260
261An option name must start with a alphabetic character, underscore, a number, '?', or '@'. For long options, after the first character '.', and '-' are also valid characters. For the `add_flag*` functions '{' has special meaning. Names are given as a comma separated string, with the dash or dashes. An option or flag can have as many names as you want, and afterward, using `count`, you can use any of the names, with dashes as needed, to count the options. One of the names is allowed to be given without proceeding dash(es); if present the option is a positional option, and that name will be used on the help line for its positional form.
262
263The `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
265The two parameter template overload can be used in cases where you want to restrict the input such as
266```
267double val
268app.add_option<double,unsigned int>("-v",val);
269```
270which would first verify the input is convertible to an `unsigned int` before assigning it.  Or using some variant type
271```
272using vtype=std::variant<int, double, std::string>;
273 vtype v1;
274app.add_option<vtype,std:string>("--vs",v1);
275app.add_option<vtype,int>("--vi",v1);
276app.add_option<vtype,double>("--vf",v1);
277```
278otherwise the output would default to a string.  The `add_option` can be used with any integral or floating point types, enumerations, or strings.  Or any type that takes an int, double, or std\::string in an assignment operator or constructor.  If an object can take multiple varieties of those, std::string takes precedence, then double then int.    To better control which one is used or to use another type for the underlying conversions use the two parameter template to directly specify the conversion type.
279
280Types such as (std or boost) `optional<int>`, `optional<double>`, and `optional<string>` and any other wrapper types are supported directly. For purposes of CLI11 wrapper types are those which `value_type` definition.  See [CLI11 Advanced Topics/Custom Converters][] for information on how you can add your own converters for additional types.
281
282Vector types can also be used in the two parameter template overload
283```
284std::vector<double> v1;
285app.add_option<std::vector<double>,int>("--vs",v1);
286```
287would load a vector of doubles but ensure all values can be represented as integers.
288
289Automatic direct capture of the default string is disabled when using the two parameter template.  Use `set_default_str(...)` or `->default_function(std::string())` to set the default string or capture function directly for these cases.
290
291Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed.  For example:
292
293```cpp
294app.add_flag("--flag,!--no-flag",result,"help for flag");
295```
296
297specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is
298passed `result` will contain false or -1 if `result` is a signed integer type, or 0 if it is an unsigned type.  An
299alternative form of the syntax is more explicit: `"--flag,--no-flag{false}"`; this is equivalent to the previous
300example.  This also works for short form options `"-f,!-n"` or `"-f,-n{false}"`. If `variable_to_bind_to` is anything but an integer value the
301default behavior is to take the last value given, while if `variable_to_bind_to` is an integer type the behavior will be to sum
302all the given arguments and return the result.  This can be modified if needed by changing the `multi_option_policy` on each flag (this is not inherited).
303The default value can be any value. For example if you wished to define a numerical flag:
304
305```cpp
306app.add_flag("-1{1},-2{2},-3{3}",result,"numerical flag")
307```
308
309using any of those flags on the command line will result in the specified number in the output.  Similar things can be done for string values, and enumerations, as long as the default value can be converted to the given type.
310
311
312On a `C++14` compiler, you can pass a callback function directly to `.add_flag`, while in C++11 mode you'll need to use `.add_flag_function` if you want a callback function. The function will be given the number of times the flag was passed. You can throw a relevant `CLI::ParseError` to signal a failure.
313
314#### Example
315
316-   `"one,-o,--one"`: Valid as long as not a flag, would create an option that can be specified positionally, or with `-o` or `--one`
317-   `"this"` Can only be passed positionally
318-   `"-a,-b,-c"` No limit to the number of non-positional option names
319
320The add commands return a pointer to an internally stored `Option`.
321This option can be used directly to check for the count (`->count()`) after parsing to avoid a string based lookup.
322⚠️  Deprecated: The `add_*` commands have a final argument than can be set to true, which causes the default value to be captured and printed on the command line with the help flag. Since CLI11 1.8, you can simply add `->capture_default_str()`.
323
324#### Option options
325
326Before parsing, you can set the following options:
327
328-   `->required()`: The program will quit if this option is not present. This is `mandatory` in Plumbum, but required options seems to be a more standard term. For compatibility, `->mandatory()` also works.
329-   `->expected(N)`: Take `N` values instead of as many as possible, only for vector args. If negative, require at least `-N`; end with `--` or another recognized option or subcommand.
330-   `->type_name(typename)`: Set the name of an Option's type (`type_name_fn` allows a function instead)
331-   `->type_size(N)`: Set the intrinsic size of an option. The parser will require multiples of this number if negative.
332-   `->needs(opt)`: This option requires another option to also be present, opt is an `Option` pointer.
333-   `->excludes(opt)`: This option cannot be given with `opt` present, opt is an `Option` pointer.
334-   `->envname(name)`: Gets the value from the environment if present and not passed on the command line.
335-   `->group(name)`: The help group to put the option in. No effect for positional options. Defaults to `"Options"`. `""` will not show up in the help print (hidden).
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
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.
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.
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).
343-   `->check(std::string(const std::string &), validator_name="",validator_description="")`: Define a check function.  The function should return a non empty string with the error message if the check fails
344-   `->check(Validator)`: Use a Validator object to do the check see [Validators](#validators) for a description of available Validators and how to create new ones.
345-   `->transform(std::string(std::string &), validator_name="",validator_description=")`: Converts the input string into the output string, in-place in the parsed options.
346-   `->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.
347-   `->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.
348-   `->configurable(false)`: Disable this option from being in a configuration file.
349    `->capture_default_str()`: Store the current value attached and display it in the help string.
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`.
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).
354-   `->option_text(string)`: Sets the text between the option name and description.
355
356
357These options return the `Option` pointer, so you can chain them together, and even skip storing the pointer entirely. The `each` function 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 `each`, `check` and `transform` use the same underlying mechanism, you can chain as many as you want, and they will be executed in order. Operations added through `transform` are executed first in reverse order of addition, and `check` and `each` are run following the transform functions in order of addition. If you just want to see the unconverted values, use `.results()` to get the `std::vector<std::string>` of results.
358
359On the command line, options can be given as:
360
361-   `-a` (flag)
362-   `-abc` (flags can be combined)
363-   `-f filename` (option)
364-   `-ffilename` (no space required)
365-   `-abcf filename` (flags and option can be combined)
366-   `--long` (long flag)
367-   `--long_flag=true` (long flag with equals to override default value)
368-   `--file filename` (space)
369-   `--file=filename` (equals)
370
371If `allow_windows_style_options()` is specified in the application or subcommand options can also be given as:
372-   `/a` (flag)
373-   `/f filename` (option)
374-   `/long` (long flag)
375-   `/file filename` (space)
376-   `/file:filename` (colon)
377-   `/long_flag:false` (long flag with : to override the default value)
378=  Windows style options do not allow combining short options or values not separated from the short option like with `-` options
379
380Long 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()`.
381
382Extra positional arguments will cause the program to exit, so at least one positional option with a vector is recommended if you want to allow extraneous arguments.
383If you set `.allow_extras()` on the main `App`, you will not get an error. You can access the missing options using `remaining` (if you have subcommands, `app.remaining(true)` will get all remaining options, subcommands included).
384If the remaining arguments are to processed by another `App` then the function `remaining_for_passthrough()` can be used to get the remaining arguments in reverse order such that `app.parse(vector)` works directly and could even be used inside a subcommand callback.
385
386You can access a vector of pointers to the parsed options in the original order using `parse_order()`.
387If `--` is present in the command line that does not end an unlimited option, then
388everything after that is positional only.
389
390#### Validators
391Validators are structures to check or modify inputs, they can be used to verify that an input meets certain criteria or transform it into another value.  They are added through the `check` or `transform` functions.  The differences between the two function are that checks do not modify the input whereas transforms can and are executed before any Validators added through `check`.
392
393CLI11 has several Validators built-in that perform some common checks
394
395-   `CLI::IsMember(...)`: Require an option be a member of a given set. See [Transforming Validators](#transforming-validators) for more details.
396-   `CLI::Transformer(...)`: Modify the input using a map. See [Transforming Validators](#transforming-validators) for more details.
397-   `CLI::CheckedTransformer(...)`: Modify the input using a map, and require that the input is either in the set or already one of the outputs of the set. See [Transforming Validators](#transforming-validators) for more details.
398-   `CLI::AsNumberWithUnit(...)`: Modify the `<NUMBER> <UNIT>` pair by matching the unit and multiplying the number by the corresponding factor. It can be used as a base for transformers, that accept things like size values (`1 KB`) or durations (`0.33 ms`).
399-   `CLI::AsSizeValue(...)`: Convert inputs like `100b`, `42 KB`, `101 Mb`, `11 Mib` to absolute values. `KB` can be configured to be interpreted as 10^3 or 2^10.
400-   `CLI::ExistingFile`: Requires that the file exists if given.
401-   `CLI::ExistingDirectory`: Requires that the directory exists.
402-   `CLI::ExistingPath`: Requires that the path (file or directory) exists.
403-   `CLI::NonexistentPath`: Requires that the path does not exist.
404-   `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.
405-   `CLI::Bounded(min,max)`: Modify the input such that it is always between min and max (make sure to use floating point if needed). Min defaults to 0.  Will produce an error if conversion is not possible.
406-   `CLI::PositiveNumber`: Requires the number be greater than 0
407-   `CLI::NonNegativeNumber`: Requires the number be greater or equal to 0
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'`.
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
412These Validators can be used by simply passing the name into the `check` or `transform` methods on an option
413
414```cpp
415->check(CLI::ExistingFile);
416->check(CLI::Range(0,10));
417```
418
419Validators can be merged using `&` and `|` and inverted using `!`. For example:
420
421```cpp
422->check(CLI::Range(0,10)|CLI::Range(20,30));
423```
424
425will produce a check to ensure a value is between 0 and 10 or 20 and 30.
426
427```cpp
428->check(!CLI::PositiveNumber);
429```
430
431will produce a check for a number less than or equal to 0.
432
433##### Transforming Validators
434There are a few built in Validators that let you transform values if used with the `transform` function.  If they also do some checks then they can be used `check` but some may do nothing in that case.
435-   `CLI::Bounded(min,max)` will bound values between min and max and values outside of that range are limited to min or max,  it will fail if the value cannot be converted and produce a `ValidationError`
436-   The `IsMember` Validator lets you specify a set of predefined options. You can pass any container or copyable pointer (including `std::shared_ptr`) to a container to this Validator; the container just needs to be iterable and have a `::value_type`. The key type should be convertible from a string,  You can use an initializer list directly if you like. If you need to modify the set later, the pointer form lets you do that; the type message and check will correctly refer to the current version of the set.  The container passed in can be a set, vector, or a map like structure. If used in the `transform` method the output value will be the matching key as it could be modified by filters.
437After specifying a set of options, you can also specify "filter" functions of the form `T(T)`, where `T` is the type of the values. The most common choices probably will be `CLI::ignore_case` an `CLI::ignore_underscore`, and `CLI::ignore_space`.  These all work on strings but it is possible to define functions that work on other types.
438Here are some examples
439of `IsMember`:
440
441-   `CLI::IsMember({"choice1", "choice2"})`: Select from exact match to choices.
442-   `CLI::IsMember({"choice1", "choice2"}, CLI::ignore_case, CLI::ignore_underscore)`: Match things like `Choice_1`, too.
443-   `CLI::IsMember(std::set<int>({2,3,4}))`: Most containers and types work; you just need `std::begin`, `std::end`, and `::value_type`.
444-   `CLI::IsMember(std::map<std::string, TYPE>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched value with the matched key.  The value member of the map is not used in `IsMember`, so it can be any type.
445-   `auto p = std::make_shared<std::vector<std::string>>(std::initializer_list<std::string>("one", "two")); CLI::IsMember(p)`: You can modify `p` later.
446-   The `Transformer` and `CheckedTransformer` Validators transform one value into another. Any container or copyable pointer (including `std::shared_ptr`) to a container that generates pairs of values can be passed to these `Validator's`; the container just needs to be iterable and have a `::value_type` that consists of pairs. The key type should be convertible from a string, and the value type should be convertible to a string  You can use an initializer list directly if you like. If you need to modify the map later, the pointer form lets you do that; the description message will correctly refer to the current version of the map.  `Transformer` does not do any checking so values not in the map are ignored.  `CheckedTransformer` takes an extra step of verifying that the value is either one of the map key values, in which case it is transformed, or one of the expected output values, and if not will generate a `ValidationError`.  A Transformer placed using `check` will not do anything.
447After specifying a map of options, you can also specify "filter" just like in `CLI::IsMember`.
448Here are some examples (`Transformer` and `CheckedTransformer` are interchangeable in the examples)
449of `Transformer`:
450
451-   `CLI::Transformer({{"key1", "map1"},{"key2","map2"}})`: Select from key values and produce map values.
452
453-   `CLI::Transformer(std::map<std::string,int>({"two",2},{"three",3},{"four",4}}))`: most maplike containers work,  the `::value_type` needs to produce a pair of some kind.
454-   `CLI::CheckedTransformer(std::map<std::string, int>({{"one", 1}, {"two", 2}}))`: You can use maps; in `->transform()` these replace the matched key with the value.  `CheckedTransformer` also requires that the value either match one of the keys or match one of known outputs.
455-   `auto p = std::make_shared<CLI::TransformPairs<std::string>>(std::initializer_list<std::pair<std::string,std::string>>({"key1", "map1"},{"key2","map2"})); CLI::Transformer(p)`: You can modify `p` later. `TransformPairs<T>` is an alias for `std::vector<std::pair<<std::string,T>>`
456
457NOTES:  If the container used in `IsMember`, `Transformer`, or `CheckedTransformer` has a `find` function like `std::unordered_map`  or `std::map` then that function is used to do the searching. If it does not have a `find` function a linear search is performed.  If there are filters present, the fast search is performed first, and if that fails a linear search with the filters on the key values is performed.
458
459##### Validator operations
460Validators 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)`.
461The 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)`
462The 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.
464```cpp
465opt->check(CLI::Validator(CLI::PositiveNumber).application_index(0));
466opt->check(CLI::Validator(CLI::ExistingFile).application_index(1));
467```
468
469All the validator operation functions return a Validator reference allowing them to be chained.  For example
470
471```cpp
472opt->check(CLI::Range(10,20).description("range is limited to sensible values").active(false).name("range"));
473```
474
475will specify a check on an option with a name "range", but deactivate it for the time being.
476The check can later be activated through
477
478```cpp
479opt->get_validator("range")->active();
480```
481
482##### Custom Validators
483
484A validator object with a custom function can be created via
485
486```cpp
487CLI::Validator(std::function<std::string(std::string &)>,validator_description,validator_name="");
488```
489
490or if the operation function is set later they can be created with
491
492```cpp
493CLI::Validator(validator_description);
494```
495
496 It is also possible to create a subclass of `CLI::Validator`, in which case it can also set a custom description function, and operation function.
497
498##### Querying Validators
499
500Once loaded into an Option, a pointer to a named Validator can be retrieved via
501
502```cpp
503opt->get_validator(name);
504```
505
506This 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
508or
509
510```cpp
511opt->get_validator(index);
512```
513
514Which will return a validator in the index it is applied which isn't necessarily the order in which was defined.  The pointer can be `nullptr` if an invalid index is given.
515Validators have a few functions to query the current values
516-   `get_description()`: Will return a description string
517-   `get_name()`: Will return the Validator name
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.
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
522#### Getting results
523
524In most cases, the fastest and easiest way is to return the results through a callback or variable specified in one of the `add_*` functions.  But there are situations where this is not possible or desired.  For these cases the results may be obtained through one of the following functions. Please note that these functions will do any type conversions and processing during the call so should not used in performance critical code:
525
526-   `results()`: Retrieves a vector of strings with all the results in the order they were given.
527-   `results(variable_to_bind_to)`: Gets the results according to the MultiOptionPolicy and converts them just like the `add_option_function` with a variable.
528-   `Value=as<type>()`: Returns the result or default value directly as the specified type if possible, can be vector to return all results, and a non-vector to get the result according to the MultiOptionPolicy in place.
529
530### Subcommands
531
532Subcommands are supported, and can be nested infinitely. To add a subcommand, call the `add_subcommand` method with a name and an optional description. This gives a pointer to an `App` that behaves just like the main app, and can take options or further subcommands. Add `->ignore_case()` to a subcommand to allow any variation of caps to also be accepted. `->ignore_underscore()` is similar, but for underscores. Children inherit the current setting from the parent. You cannot add multiple matching subcommand names at the same level (including `ignore_case` and `ignore_underscore`).
533
534If you want to require that at least one subcommand is given, use `.require_subcommand()` on the parent app. You can optionally give an exact number of subcommands to require, as well. If you give two arguments, that sets the min and max number allowed.
5350 for the max number allowed will allow an unlimited number of subcommands. As a handy shortcut, a single negative value N will set "up to N" values. Limiting the maximum number allows you to keep arguments that match a previous
536subcommand name from matching.
537
538If an `App` (main or subcommand) has been parsed on the command line, `->parsed` will be true (or convert directly to bool).
539All `App`s have a `get_subcommands()` method, which returns a list of pointers to the subcommands passed on the command line. A `got_subcommand(App_or_name)` method is also provided that will check to see if an `App` pointer or a string name was collected on the command line.
540
541For many cases, however, using an app's callback capabilities may be easier. Every app has a set of callbacks that can be executed at various stages of parsing; a `C++` lambda function (with capture to get parsed values) can be used as input to the callback definition function. If you throw `CLI::Success` or `CLI::RuntimeError(return_value)`, you can
542even exit the program through the callback.
543
544Multiple subcommands are allowed, to allow [`Click`][click] like series of commands (order is preserved).  The same subcommand can be triggered multiple times but all positional arguments will take precedence over the second and future calls of the subcommand.  `->count()` on the subcommand will return the number of times the subcommand was called.  The subcommand callback will only be triggered once unless the `.immediate_callback()`  flag is set or the callback is specified through the `parse_complete_callback()` function. The `final_callback()` is triggered only once.  In which case the callback executes on completion of the subcommand arguments but after the arguments for that subcommand have been parsed, and can be triggered multiple times.
545
546Subcommands may also have an empty name either by calling `add_subcommand` with an empty string for the name or with no arguments.
547Nameless subcommands function a similarly to groups in the main `App`. See [Option groups](#option-groups) to see how this might work.  If an option is not defined in the main App, all nameless subcommands are checked as well.  This allows for the options to be defined in a composable group.  The `add_subcommand` function has an overload for adding a `shared_ptr<App>` so the subcommand(s) could be defined in different components and merged into a main `App`, or possibly multiple `Apps`.  Multiple nameless subcommands are allowed.  Callbacks for nameless subcommands are only triggered if any options from the subcommand were parsed.
548
549#### Subcommand options
550
551There are several options that are supported on the main app and subcommands and option_groups. These are:
552
553-   `.ignore_case()`: Ignore the case of this subcommand. 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`.
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.
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.
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
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.
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.
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.
568-   `.require_subcommand()`: Require 1 or more subcommands.
569-   `.require_subcommand(N)`: Require `N` subcommands if `N>0`, or up to `N` if `N<0`. `N=0` resets to the default to 0 or more.
570-   `.require_subcommand(min, max)`: Explicitly set min and max allowed subcommands. Setting `max` to 0 is unlimited.
571-   `.add_subcommand(name="", description="")`: Add a subcommand, returns a pointer to the internally stored subcommand.
572-   `.add_subcommand(shared_ptr<App>)`: Add a subcommand by shared_ptr, returns a pointer to the internally stored subcommand.
573-   `.remove_subcommand(App)`: Remove a subcommand from the app or subcommand.
574-   `.got_subcommand(App_or_name)`: Check to see if a subcommand was received on the command line.
575-   `.get_subcommands(filter)`: The list of subcommands that match a particular filter function.
576-   `.add_option_group(name="", description="")`: Add an [option group](#option-groups) to an App,  an option group is specialized subcommand intended for containing groups of options or other groups for controlling how options interact.
577-   `.get_parent()`: Get the parent App or `nullptr` if called on master App.
578-   `.get_option(name)`: Get an option pointer by option name will throw if the specified option is not available,  nameless subcommands are also searched
579-   `.get_option_no_throw(name)`: Get an option pointer by option name. This function will return a `nullptr` instead of throwing if the option is not available.
580-   `.get_options(filter)`: Get the list of all defined option pointers (useful for processing the app for custom output formats).
581-   `.parse_order()`: Get the list of option pointers in the order they were parsed (including duplicates).
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.
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.
586-   `.parsed()`: True if this subcommand was given on the command line.
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.
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.
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.
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.
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.
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.
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.
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.
606-   `[option_name]`: retrieve a const pointer to an option given by `option_name` for Example `app["--flag1"]` will get a pointer to the option for the "--flag1" value,  `app["--flag1"]->as<bool>()` will get the results of the command line for a flag. The operation will throw an exception if the option name is not valid.
607
608> Note: if you have a fixed number of required positional options, that will match before subcommand names. `{}` is an empty filter function, and any positional argument will match before repeated subcommand names.
609
610
611#### Callbacks
612A 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.
613The 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`.
614For example say an application was set up like
615
616```cpp
617app.parse_complete_callback(ac1);
618app.final_callback(ac2);
619auto sub1=app.add_subcommand("sub1")->parse_complete_callback(c1)->preparse_callback(pc1);
620auto sub2=app.add_subcommand("sub2")->final_callback(c2)->preparse_callback(pc2);
621app.preparse_callback( pa);
622
623... A bunch of other options
624
625```
626
627Then the command line is given as
628
629```
630program --opt1 opt1_val  sub1 --sub1opt --sub1optb val sub2 --sub2opt sub1 --sub1opt2 sub2 --sub2opt2 val
631```
632
633-   pa will be called prior to parsing any values with an argument of 13.
634-   pc1 will be called immediately after processing the sub1 command with a value of 10.
635-   c1 will be called when the `sub2` command is encountered.
636-   pc2 will be called with value of 6 after the sub2 command is encountered.
637-   c1 will be called again after the second sub2 command is encountered.
638-   ac1 will be called after processing of all arguments
639-   c2 will be called once after processing all arguments.
640-   ac2 will be called last after completing  all lower level callbacks have been executed.
641
642A subcommand is considered terminated when one of the following conditions are met.
6431. There are no more arguments to process
6442. Another subcommand is encountered that would not fit in an optional slot of the subcommand
6453. The `positional_mark` (`--`) is encountered and there are no available positional slots in the subcommand.
6464. The `subcommand_terminator` mark (`++`) is encountered
647
648Prior to executed a `parse_complete_callback` all contained options are processed before the callback is triggered.  If a subcommand with a `parse_complete_callback` is called again, then the contained options are reset, and can be triggered again.
649
650
651
652#### Option groups
653
654The subcommand method
655
656```cpp
657.add_option_group(name,description)
658```
659
660Will create an option group, and return a pointer to it. The argument for `description` is optional and can be omitted.  An option group allows creation of a collection of options, similar to the groups function on options, but with additional controls and requirements.  They allow specific sets of options to be composed and controlled as a collective.  For an example see [range example](https://github.com/CLIUtils/CLI11/blob/master/examples/ranges.cpp).  Option groups are a specialization of an App so all [functions](#subcommand-options) that work with an App or subcommand also work on option groups.  Options can be created as part of an option group using the add functions just like a subcommand, or previously created options can be added through
661
662```cpp
663ogroup->add_option(option_pointer);
664ogroup->add_options(option_pointer);
665ogroup->add_options(option1,option2,option3,...);
666```
667
668The option pointers used in this function must be options defined in the parent application of the option group otherwise an error will be generated.  Subcommands can also be added via
669
670```cpp
671ogroup->add_subcommand(subcom_pointer);
672```
673
674This results in the subcommand being moved from its parent into the option group.
675
676Options in an option group are searched for a command line match after any options in the main app, so any positionals in the main app would be matched first.  So care must be taken to make sure of the order when using positional arguments and option groups.
677Option groups work well with `excludes` and `require_options` methods, as an application will treat an option group as a single option for the purpose of counting and requirements, and an option group will be considered used if any of the options or subcommands contained in it are used.  Option groups allow specifying requirements such as requiring 1 of 3 options in one group and 1 of 3 options in a different group. Option groups can contain other groups as well.   Disabling an option group will turn off all options within the group.
678
679The `CLI::TriggerOn` and `CLI::TriggerOff` methods are helper functions to allow the use of options/subcommands from one group to trigger another group on or off.
680
681```cpp
682CLI::TriggerOn(group1_pointer, triggered_group);
683CLI::TriggerOff(group2_pointer, disabled_group);
684```
685
686These 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
688Additional helper functions `deprecate_option` and `retire_option` are available to deprecate or retire options
689```cpp
690CLI::deprecate_option(option *, replacement_name="");
691CLI::deprecate_option(App,option_name,replacement_name="");
692```
693will specify that the option is deprecated which will display a message in the help and a warning on first usage.  Deprecated options function normally but will add a message in the help and display a warning on first use.
694
695```cpp
696CLI::retire_option(App,option *);
697CLI::retire_option(App,option_name);
698```
699will create an option that does nothing by default and will display a warning on first usage that the option is retired and has no effect.  If the option exists it is replaces with a dummy option that takes the same arguments.
700
701If an empty string is passed the option group name the entire group will be hidden in the help results.  For example.
702
703```cpp
704auto hidden_group=app.add_option_group("");
705```
706will create a group such that no options in that group are displayed in the help string.
707
708### Configuration file
709
710```cpp
711app.set_config(option_name="",
712               default_file_name="",
713               help_string="Read an ini file",
714               required=false)
715```
716
717If 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
719```toml
720# Comments are supported, using a #
721# The default section is [default], case insensitive
722
723value = 1
724str = "A string"
725vector = [1,2,3]
726str_vector = ["one","two","and three"]
727
728# Sections map to subcommands
729[subcommand]
730in_subcommand = Wow
731sub.subcommand = true
732```
733or equivalently in INI format
734```ini
735; Comments are supported, using a ;
736; The default section is [default], case insensitive
737
738value = 1
739str = "A string"
740vector = 1 2 3
741str_vector = "one" "two" "and three"
742
743; Sections map to subcommands
744[subcommand]
745in_subcommand = Wow
746sub.subcommand = true
747```
748
749Spaces 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
751To print a configuration file from the passed
752arguments, 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.
753
754If it is desired that multiple configuration be allowed.  Use
755
756```cpp
757app.set_config("--config")->expected(1, X);
758```
759
760Where 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
762### Inheriting defaults
763
764Many 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`, `ignore_underscore`, `fallthrough`, `group`, `footer`,`immediate_callback` and maximum number of required subcommands. The help flag existence, name, and description are inherited, as well.
765
766Options have defaults for `group`, `required`, `multi_option_policy`, `ignore_case`, `ignore_underscore`, `delimiter`, and `disable_flag_override`. To set these defaults, you should set the `option_defaults()` object, for example:
767
768```cpp
769app.option_defaults()->required();
770// All future options will be required
771```
772
773The default settings for options are inherited to subcommands, as well.
774
775### Formatting
776
777The job of formatting help printouts is delegated to a formatter callable object on Apps and Options. You are free to replace either formatter by calling `formatter(fmt)` on an `App`, where fmt is any copyable callable with the correct signature.
778CLI11 comes with a default App formatter functional, `Formatter`. It is customizable; you can set `label(key, value)` to replace the default labels like `REQUIRED`, and `column_width(n)` to set the width of the columns before you add the functional to the app or option. You can also override almost any stage of the formatting process in a subclass of either formatter. If you want to make a new formatter from scratch, you can do
779that too; you just need to implement the correct signature. The first argument is a const pointer to the in question. The formatter will get a `std::string` usage name as the second option, and a `AppFormatMode` mode for the final option. It should return a `std::string`.
780
781The `AppFormatMode` can be `Normal`, `All`, or `Sub`, and it indicates the situation the help was called in. `Sub` is optional, but the default formatter uses it to make sure expanded subcommands are called with
782their own formatter since you can't access anything but the call operator once a formatter has been set.
783
784### Subclassing
785
786The App class was designed allow toolkits to subclass it, to provide preset default options (see above) and setup/teardown code. Subcommands remain an unsubclassed `App`, since those are not expected to need setup and teardown. The default `App` only adds a help flag, `-h,--help`, than can removed/replaced using `.set_help_flag(name, help_string)`. You can also set a help-all flag with `.set_help_all_flag(name, help_string)`; this will expand the subcommands (one level only). You can remove options if you have pointers to them using `.remove_option(opt)`. You can add a `pre_callback` override to customize the after parse
787but before run behavior, while
788still giving the user freedom to `callback` on the main app.
789
790The most important parse function is `parse(std::vector<std::string>)`, which takes a reversed list of arguments (so that `pop_back` processes the args in the correct order). `get_help_ptr` and `get_config_ptr` give you access to the help/config option pointers. The standard `parse` manually sets the name from the first argument, so it should not be in this vector. You can also use `parse(string, bool)` to split up and parse a single string; the optional boolean should be set to true if you are
791including the program name in the string, and false otherwise.  The program name can contain spaces if it is an existing file,  otherwise can be enclosed in quotes(single quote, double quote or backtick).  Embedded quote characters can be escaped with `\`.
792
793Also, in a related note, the `App` you get a pointer to is stored in the parent `App` in a `shared_ptr`s (similar to `Option`s) and are deleted when the main `App` goes out of scope unless the object has another owner.
794
795### How it works
796
797Every `add_` option you have seen so far depends on one method that takes a lambda function. Each of these methods is just making a different lambda function with capture to populate the option. The function has full access to the vector of strings, so it knows how many times an option was passed or how many arguments it received. The lambda returns `true` if it could validate the option strings, and
798`false` if it failed.
799
800Other values can be added as long as they support `operator>>` (and defaults can be printed if they support `operator<<`). To add a new type, for example, provide a custom `operator>>` with an `istream` (inside the CLI namespace is fine if you don't want to interfere with an existing `operator>>`).
801
802If you wanted to extend this to support a completely new type, use a lambda or add a specialization of the `lexical_cast` function template in the namespace of the type you need to convert to. Some examples of some new parsers for `complex<double>` that support all of the features of a standard `add_options` call are in [one of the tests](./tests/NewParseTest.cpp). A simpler example is shown below:
803
804#### Example
805
806```cpp
807app.add_option("--fancy-count", [](std::vector<std::string> val){
808    std::cout << "This option was given " << val.size() << " times." << std::endl;
809    return true;
810    });
811```
812
813### Utilities
814
815There are a few other utilities that are often useful in CLI programming. These are in separate headers, and do not appear in `CLI11.hpp`, but are completely independent and can be used as needed. The `Timer`/`AutoTimer` class allows you to easily time a block of code, with custom print output.
816
817```cpp
818{
819CLI::AutoTimer timer {"My Long Process", CLI::Timer::Big};
820some_long_running_process();
821}
822```
823
824This will create a timer with a title (default: `Timer`), and will customize the output using the predefined `Big` output (default: `Simple`). Because it is an `AutoTimer`, it will print out the time elapsed when the timer is destroyed at the end of the block. If you use `Timer` instead, you can use `to_string` or `std::cout << timer << std::endl;` to print the time. The print function can be any function that takes two strings, the title and the time, and returns a formatted
825string for printing.
826
827### Other libraries
828
829If you use the excellent [Rang][] library to add color to your terminal in a safe, multi-platform way, you can combine it with CLI11 nicely:
830
831```cpp
832std::atexit([](){std::cout << rang::style::reset;});
833try {
834    app.parse(argc, argv);
835} catch (const CLI::ParseError &e) {
836    std::cout << (e.get_exit_code()==0 ? rang::fg::blue : rang::fg::red);
837    return app.exit(e);
838}
839```
840
841This will print help in blue, errors in red, and will reset before returning the terminal to the user.
842
843If you are on a Unix-like system, and you'd like to handle control-c and color, you can add:
844
845```cpp
846 #include <csignal>
847 void signal_handler(int s) {
848     std::cout << std::endl << rang::style::reset << rang::fg::red << rang::fg::bold;
849     std::cout << "Control-C detected, exiting..." << rang::style::reset << std::endl;
850     std::exit(1); // will call the correct exit func, no unwinding of the stack though
851 }
852```
853
854And, in your main function:
855
856```cpp
857     // Nice Control-C
858     struct sigaction sigIntHandler;
859     sigIntHandler.sa_handler = signal_handler;
860     sigemptyset(&sigIntHandler.sa_mask);
861     sigIntHandler.sa_flags = 0;
862     sigaction(SIGINT, &sigIntHandler, nullptr);
863```
864
865## API
866
867The API is [documented here][api-docs]. Also see the [CLI11 tutorial GitBook][gitbook].
868
869## Examples
870
871Several short examples of different features are included in the repository. A brief description of each is included here
872
873 - [callback_passthrough](https://github.com/CLIUtils/CLI11/blob/master/examples/callback_passthrough.cpp): Example of directly passing remaining arguments through to a callback function which generates a CLI11 application based on existing arguments.
874 - [custom_parse](https://github.com/CLIUtils/CLI11/blob/master/examples/custom_parse.cpp):  Based on [Issue #566](https://github.com/CLIUtils/CLI11/issues/566), example of custom parser
875 - [digit_args](https://github.com/CLIUtils/CLI11/blob/master/examples/digit_args.cpp):  Based on [Issue #123](https://github.com/CLIUtils/CLI11/issues/123), uses digit flags to pass a value
876 - [enum](https://github.com/CLIUtils/CLI11/blob/master/examples/enum.cpp):  Using enumerations in an option, and the use of [CheckedTransformer](#transforming-validators)
877 - [enum_ostream](https://github.com/CLIUtils/CLI11/blob/master/examples/enum_ostream.cpp):  In addition to the contents of example enum.cpp, this example shows how a custom ostream operator overrides CLI11's enum streaming.
878 - [formatter](https://github.com/CLIUtils/CLI11/blob/master/examples/formatter.cpp): Illustrating usage of a custom formatter
879 - [groups](https://github.com/CLIUtils/CLI11/blob/master/examples/groups.cpp):  Example using groups of options for help grouping and a the timer helper class
880 - [inter_argument_order](https://github.com/CLIUtils/CLI11/blob/master/examples/inter_argument_order.cpp): An app to practice mixing unlimited arguments, but still recover the original order.
881 - [json](https://github.com/CLIUtils/CLI11/blob/master/examples/json.cpp):  Using JSON as a config file parser
882 - [modhelp](https://github.com/CLIUtils/CLI11/blob/master/examples/modhelp.cpp):  How to modify the help flag to do something other than default
883 - [nested](https://github.com/CLIUtils/CLI11/blob/master/examples/nested.cpp):  Nested subcommands
884 - [option_groups](https://github.com/CLIUtils/CLI11/blob/master/examples/option_groups.cpp):  illustrating the use of option groups and a required number of options.
885 based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88) to set interacting groups of options
886 - [positional_arity](https://github.com/CLIUtils/CLI11/blob/master/examples/positional_arity.cpp): Illustrating use of `preparse_callback` to handle situations where the number of arguments can determine which should get parsed,  Based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166)
887 - [positional_validation](https://github.com/CLIUtils/CLI11/blob/master/examples/positional_validation.cpp): Example of how positional arguments are validated using the `validate_positional` flag, also based on [Issue #166](https://github.com/CLIUtils/CLI11/issues/166)
888 - [prefix_command](https://github.com/CLIUtils/CLI11/blob/master/examples/prefix_command.cpp): illustrating use of the `prefix_command` flag.
889 - [ranges](https://github.com/CLIUtils/CLI11/blob/master/examples/ranges.cpp):  App to demonstrate exclusionary option groups based on [Issue #88](https://github.com/CLIUtils/CLI11/issues/88)
890 - [shapes](https://github.com/CLIUtils/CLI11/blob/master/examples/shapes.cpp): illustrating how to set up repeated subcommands Based on [gitter discussion](https://gitter.im/CLI11gitter/Lobby?at=5c7af6b965ffa019ea788cd5)
891 - [simple](https://github.com/CLIUtils/CLI11/blob/master/examples/simple.cpp): a simple example of how to set up a CLI11 Application with different flags and options
892 - [subcom_help](https://github.com/CLIUtils/CLI11/blob/master/examples/subcom_help.cpp): configuring help for subcommands
893 - [subcom_partitioned](https://github.com/CLIUtils/CLI11/blob/master/examples/subcom_partitioned.cpp): Example with a timer and subcommands generated separately and added to the main app later.
894 - [subcommands](https://github.com/CLIUtils/CLI11/blob/master/examples/subcommands.cpp): Short example of subcommands
895 - [validators](https://github.com/CLIUtils/CLI11/blob/master/examples/validators.cpp): Example illustrating use of validators
896
897## Contribute
898
899To contribute, open an [issue][github issues] or [pull request][github pull requests] on GitHub, or ask a question on [gitter][]. There is also a short note to contributors [here](./.github/CONTRIBUTING.md).
900This readme roughly follows the [Standard Readme Style][] and includes a mention of almost every feature of the library. More complex features are documented in more detail in the [CLI11 tutorial GitBook][gitbook].
901
902This project was created by [Henry Schreiner](https://github.com/henryiii) and major features were added by  [Philip Top](https://github.com/phlptp). Special thanks to all the contributors ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
903
904
905<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
906<!-- prettier-ignore-start -->
907<!-- markdownlint-disable -->
908<table>
909  <tr>
910    <td align="center"><a href="http://iscinumpy.gitlab.io"><img src="https://avatars1.githubusercontent.com/u/4616906?v=4" width="100px;" alt=""/><br /><sub><b>Henry Schreiner</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Ahenryiii" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=henryiii" title="Documentation">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=henryiii" title="Code">��</a></td>
911    <td align="center"><a href="https://github.com/phlptp"><img src="https://avatars0.githubusercontent.com/u/20667153?v=4" width="100px;" alt=""/><br /><sub><b>Philip Top</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Aphlptp" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=phlptp" title="Documentation">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=phlptp" title="Code">��</a></td>
912    <td align="center"><a href="https://www.linkedin.com/in/cbachhuber/"><img src="https://avatars0.githubusercontent.com/u/27212661?v=4" width="100px;" alt=""/><br /><sub><b>Christoph Bachhuber</b></sub></a><br /><a href="#example-cbachhuber" title="Examples">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=cbachhuber" title="Code">��</a></td>
913    <td align="center"><a href="https://lambdafu.net/"><img src="https://avatars1.githubusercontent.com/u/1138455?v=4" width="100px;" alt=""/><br /><sub><b>Marcus Brinkmann</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Alambdafu" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=lambdafu" title="Code">��</a></td>
914    <td align="center"><a href="https://github.com/SkyToGround"><img src="https://avatars1.githubusercontent.com/u/58835?v=4" width="100px;" alt=""/><br /><sub><b>Jonas Nilsson</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3ASkyToGround" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=SkyToGround" title="Code">��</a></td>
915    <td align="center"><a href="https://github.com/dvj"><img src="https://avatars2.githubusercontent.com/u/77217?v=4" width="100px;" alt=""/><br /><sub><b>Doug Johnston</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Advj" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=dvj" title="Code">��</a></td>
916    <td align="center"><a href="http://lucas-czech.de"><img src="https://avatars0.githubusercontent.com/u/4741887?v=4" width="100px;" alt=""/><br /><sub><b>Lucas Czech</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Alczech" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=lczech" title="Code">��</a></td>
917  </tr>
918  <tr>
919    <td align="center"><a href="https://github.com/rafiw"><img src="https://avatars3.githubusercontent.com/u/3034707?v=4" width="100px;" alt=""/><br /><sub><b>Rafi Wiener</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Arafiw" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=rafiw" title="Code">��</a></td>
920    <td align="center"><a href="https://github.com/mensinda"><img src="https://avatars3.githubusercontent.com/u/3407462?v=4" width="100px;" alt=""/><br /><sub><b>Daniel Mensinger</b></sub></a><br /><a href="#platform-mensinda" title="Packaging/porting to new platform">��</a></td>
921    <td align="center"><a href="https://github.com/jbriales"><img src="https://avatars1.githubusercontent.com/u/6850478?v=4" width="100px;" alt=""/><br /><sub><b>Jesus Briales</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=jbriales" title="Code">��</a> <a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Ajbriales" title="Bug reports">��</a></td>
922    <td align="center"><a href="https://seanfisk.com/"><img src="https://avatars0.githubusercontent.com/u/410322?v=4" width="100px;" alt=""/><br /><sub><b>Sean Fisk</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Aseanfisk" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=seanfisk" title="Code">��</a></td>
923    <td align="center"><a href="https://github.com/fpeng1985"><img src="https://avatars1.githubusercontent.com/u/87981?v=4" width="100px;" alt=""/><br /><sub><b>fpeng1985</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=fpeng1985" title="Code">��</a></td>
924    <td align="center"><a href="https://github.com/almikhayl"><img src="https://avatars2.githubusercontent.com/u/6747040?v=4" width="100px;" alt=""/><br /><sub><b>almikhayl</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=almikhayl" title="Code">��</a> <a href="#platform-almikhayl" title="Packaging/porting to new platform">��</a></td>
925    <td align="center"><a href="https://github.com/andrew-hardin"><img src="https://avatars0.githubusercontent.com/u/16496326?v=4" width="100px;" alt=""/><br /><sub><b>Andrew Hardin</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=andrew-hardin" title="Code">��</a></td>
926  </tr>
927  <tr>
928    <td align="center"><a href="https://github.com/SX91"><img src="https://avatars2.githubusercontent.com/u/754754?v=4" width="100px;" alt=""/><br /><sub><b>Anton</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=SX91" title="Code">��</a></td>
929    <td align="center"><a href="https://github.com/helmesjo"><img src="https://avatars0.githubusercontent.com/u/2501070?v=4" width="100px;" alt=""/><br /><sub><b>Fred Helmesjö</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Ahelmesjo" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=helmesjo" title="Code">��</a></td>
930    <td align="center"><a href="https://github.com/skannan89"><img src="https://avatars0.githubusercontent.com/u/11918764?v=4" width="100px;" alt=""/><br /><sub><b>Kannan</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Askannan89" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=skannan89" title="Code">��</a></td>
931    <td align="center"><a href="http://himvis.com"><img src="https://avatars3.githubusercontent.com/u/465279?v=4" width="100px;" alt=""/><br /><sub><b>Khem Raj</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=kraj" title="Code">��</a></td>
932    <td align="center"><a href="https://www.mogigoma.com/"><img src="https://avatars2.githubusercontent.com/u/130862?v=4" width="100px;" alt=""/><br /><sub><b>Mak Kolybabi</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=mogigoma" title="Documentation">��</a></td>
933    <td align="center"><a href="http://msoeken.github.io"><img src="https://avatars0.githubusercontent.com/u/1998245?v=4" width="100px;" alt=""/><br /><sub><b>Mathias Soeken</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=msoeken" title="Documentation">��</a></td>
934    <td align="center"><a href="https://github.com/nathanhourt"><img src="https://avatars2.githubusercontent.com/u/271977?v=4" width="100px;" alt=""/><br /><sub><b>Nathan Hourt</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Anathanhourt" title="Bug reports">��</a> <a href="https://github.com/CLIUtils/CLI11/commits?author=nathanhourt" title="Code">��</a></td>
935  </tr>
936  <tr>
937    <td align="center"><a href="https://github.com/pleroux0"><img src="https://avatars2.githubusercontent.com/u/39619854?v=4" width="100px;" alt=""/><br /><sub><b>Paul le Roux</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=pleroux0" title="Code">��</a> <a href="#platform-pleroux0" title="Packaging/porting to new platform">��</a></td>
938    <td align="center"><a href="https://github.com/chfast"><img src="https://avatars1.githubusercontent.com/u/573380?v=4" width="100px;" alt=""/><br /><sub><b>Paweł Bylica</b></sub></a><br /><a href="#platform-chfast" title="Packaging/porting to new platform">��</a></td>
939    <td align="center"><a href="https://github.com/peterazmanov"><img src="https://avatars0.githubusercontent.com/u/15322318?v=4" width="100px;" alt=""/><br /><sub><b>Peter Azmanov</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=peterazmanov" title="Code">��</a></td>
940    <td align="center"><a href="https://github.com/delpinux"><img src="https://avatars0.githubusercontent.com/u/35096584?v=4" width="100px;" alt=""/><br /><sub><b>Stéphane Del Pino</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=delpinux" title="Code">��</a></td>
941    <td align="center"><a href="https://github.com/metopa"><img src="https://avatars2.githubusercontent.com/u/3974178?v=4" width="100px;" alt=""/><br /><sub><b>Viacheslav Kroilov</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=metopa" title="Code">��</a></td>
942    <td align="center"><a href="http://cs.odu.edu/~ctsolakis"><img src="https://avatars0.githubusercontent.com/u/6725596?v=4" width="100px;" alt=""/><br /><sub><b>christos</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=ChristosT" title="Code">��</a></td>
943    <td align="center"><a href="https://github.com/deining"><img src="https://avatars3.githubusercontent.com/u/18169566?v=4" width="100px;" alt=""/><br /><sub><b>deining</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=deining" title="Documentation">��</a></td>
944  </tr>
945  <tr>
946    <td align="center"><a href="https://github.com/elszon"><img src="https://avatars0.githubusercontent.com/u/2971495?v=4" width="100px;" alt=""/><br /><sub><b>elszon</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=elszon" title="Code">��</a></td>
947    <td align="center"><a href="https://github.com/ncihnegn"><img src="https://avatars3.githubusercontent.com/u/12021721?v=4" width="100px;" alt=""/><br /><sub><b>ncihnegn</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=ncihnegn" title="Code">��</a></td>
948    <td align="center"><a href="https://github.com/nurelin"><img src="https://avatars3.githubusercontent.com/u/5276274?v=4" width="100px;" alt=""/><br /><sub><b>nurelin</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=nurelin" title="Code">��</a></td>
949    <td align="center"><a href="https://github.com/ryan4729"><img src="https://avatars3.githubusercontent.com/u/40183301?v=4" width="100px;" alt=""/><br /><sub><b>ryan4729</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=ryan4729" title="Tests">⚠️</a></td>
950    <td align="center"><a href="https://izzys.casa"><img src="https://avatars0.githubusercontent.com/u/63051?v=4" width="100px;" alt=""/><br /><sub><b>Isabella Muerte</b></sub></a><br /><a href="#platform-slurps-mad-rips" title="Packaging/porting to new platform">��</a></td>
951    <td align="center"><a href="https://github.com/KOLANICH"><img src="https://avatars1.githubusercontent.com/u/240344?v=4" width="100px;" alt=""/><br /><sub><b>KOLANICH</b></sub></a><br /><a href="#platform-KOLANICH" title="Packaging/porting to new platform">��</a></td>
952    <td align="center"><a href="https://github.com/jgerityneurala"><img src="https://avatars2.githubusercontent.com/u/57360646?v=4" width="100px;" alt=""/><br /><sub><b>James Gerity</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=jgerityneurala" title="Documentation">��</a></td>
953  </tr>
954  <tr>
955    <td align="center"><a href="https://github.com/jsoref"><img src="https://avatars0.githubusercontent.com/u/2119212?v=4" width="100px;" alt=""/><br /><sub><b>Josh Soref</b></sub></a><br /><a href="#tool-jsoref" title="Tools">��</a></td>
956    <td align="center"><a href="https://github.com/geir-t"><img src="https://avatars3.githubusercontent.com/u/35292136?v=4" width="100px;" alt=""/><br /><sub><b>geir-t</b></sub></a><br /><a href="#platform-geir-t" title="Packaging/porting to new platform">��</a></td>
957    <td align="center"><a href="https://ondrejcertik.com/"><img src="https://avatars3.githubusercontent.com/u/20568?v=4" width="100px;" alt=""/><br /><sub><b>Ondřej Čertík</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/issues?q=author%3Acertik" title="Bug reports">��</a></td>
958    <td align="center"><a href="http://sam.hocevar.net/"><img src="https://avatars2.githubusercontent.com/u/245089?v=4" width="100px;" alt=""/><br /><sub><b>Sam Hocevar</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=samhocevar" title="Code">��</a></td>
959    <td align="center"><a href="http://www.ratml.org/"><img src="https://avatars0.githubusercontent.com/u/1845039?v=4" width="100px;" alt=""/><br /><sub><b>Ryan Curtin</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=rcurtin" title="Documentation">��</a></td>
960    <td align="center"><a href="https://mbh.sh"><img src="https://avatars3.githubusercontent.com/u/20403931?v=4" width="100px;" alt=""/><br /><sub><b>Michael Hall</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=mbhall88" title="Documentation">��</a></td>
961    <td align="center"><a href="https://github.com/ferdymercury"><img src="https://avatars3.githubusercontent.com/u/10653970?v=4" width="100px;" alt=""/><br /><sub><b>ferdymercury</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=ferdymercury" title="Documentation">��</a></td>
962  </tr>
963  <tr>
964    <td align="center"><a href="https://github.com/jakoblover"><img src="https://avatars0.githubusercontent.com/u/14160441?v=4" width="100px;" alt=""/><br /><sub><b>Jakob Lover</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=jakoblover" title="Code">��</a></td>
965    <td align="center"><a href="https://github.com/ZeeD26"><img src="https://avatars2.githubusercontent.com/u/2487468?v=4" width="100px;" alt=""/><br /><sub><b>Dominik Steinberger</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=ZeeD26" title="Code">��</a></td>
966    <td align="center"><a href="https://github.com/dfleury2"><img src="https://avatars1.githubusercontent.com/u/4805384?v=4" width="100px;" alt=""/><br /><sub><b>D. Fleury</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=dfleury2" title="Code">��</a></td>
967    <td align="center"><a href="https://github.com/dbarowy"><img src="https://avatars3.githubusercontent.com/u/573142?v=4" width="100px;" alt=""/><br /><sub><b>Dan Barowy</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=dbarowy" title="Documentation">��</a></td>
968    <td align="center"><a href="https://github.com/paddy-hack"><img src="https://avatars.githubusercontent.com/u/6804372?v=4" width="100px;" alt=""/><br /><sub><b>Olaf Meeuwissen</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=paddy-hack" title="Code">��</a></td>
969    <td align="center"><a href="https://github.com/dryleev"><img src="https://avatars.githubusercontent.com/u/83670813?v=4" width="100px;" alt=""/><br /><sub><b>dryleev</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=dryleev" title="Code">��</a></td>
970    <td align="center"><a href="https://github.com/AnticliMaxtic"><img src="https://avatars.githubusercontent.com/u/43995389?v=4" width="100px;" alt=""/><br /><sub><b>Max</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=AnticliMaxtic" title="Code">��</a></td>
971  </tr>
972  <tr>
973    <td align="center"><a href="https://profiles.sussex.ac.uk/p281168-alex-dewar/publications"><img src="https://avatars.githubusercontent.com/u/23149834?v=4" width="100px;" alt=""/><br /><sub><b>Alex Dewar</b></sub></a><br /><a href="https://github.com/CLIUtils/CLI11/commits?author=alexdewar" title="Code">��</a></td>
974  </tr>
975</table>
976
977<!-- markdownlint-enable -->
978<!-- prettier-ignore-end -->
979<!-- ALL-CONTRIBUTORS-LIST:END -->
980
981
982This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
983
984## License
985
986As of version 1.0, this library is available under a 3-Clause BSD license. See the [LICENSE](./LICENSE) file for details.
987
988CLI11 was developed at the [University of Cincinnati][] to support of the [GooFit][] library under [NSF Award 1414736][]. Version 0.9 was featured in a [DIANA/HEP][] meeting at CERN ([see the slides][diana slides]). Please give it a try! Feedback is always welcome.
989
990[doi-badge]: https://zenodo.org/badge/80064252.svg
991[doi-link]: https://zenodo.org/badge/latestdoi/80064252
992[azure-badge]: https://dev.azure.com/CLIUtils/CLI11/_apis/build/status/CLIUtils.CLI11?branchName=master
993[azure]: https://dev.azure.com/CLIUtils/CLI11
994[travis-badge]: https://img.shields.io/travis/CLIUtils/CLI11/master.svg?label=Linux/macOS
995[travis]: https://travis-ci.org/CLIUtils/CLI11
996[appveyor-badge]: https://img.shields.io/appveyor/ci/HenrySchreiner/cli11/master.svg?label=AppVeyor
997[appveyor]: https://ci.appveyor.com/project/HenrySchreiner/cli11
998[actions-badge]: https://github.com/CLIUtils/CLI11/workflows/Tests/badge.svg
999[actions-link]:  https://github.com/CLIUtils/CLI11/actions
1000[codecov-badge]: https://codecov.io/gh/CLIUtils/CLI11/branch/master/graph/badge.svg
1001[codecov]: https://codecov.io/gh/CLIUtils/CLI11
1002[gitter-badge]: https://badges.gitter.im/CLI11gitter/Lobby.svg
1003[gitter]: https://gitter.im/CLI11gitter/Lobby
1004[license-badge]: https://img.shields.io/badge/License-BSD-blue.svg
1005[conan-badge]: https://api.bintray.com/packages/cliutils/CLI11/CLI11%3Acliutils/images/download.svg
1006[conan-link]: https://bintray.com/cliutils/CLI11/CLI11%3Acliutils/_latestVersion
1007[github releases]: https://github.com/CLIUtils/CLI11/releases
1008[github issues]: https://github.com/CLIUtils/CLI11/issues
1009[github pull requests]: https://github.com/CLIUtils/CLI11/pulls
1010[goofit]: https://GooFit.github.io
1011[plumbum]: https://plumbum.readthedocs.io/en/latest/
1012[click]: http://click.pocoo.org
1013[api-docs]: https://CLIUtils.github.io/CLI11/index.html
1014[rang]: https://github.com/agauniyal/rang
1015[boost program options]: http://www.boost.org/doc/libs/1_63_0/doc/html/program_options.html
1016[the lean mean c++ option parser]: http://optionparser.sourceforge.net
1017[tclap]: http://tclap.sourceforge.net
1018[cxxopts]: https://github.com/jarro2783/cxxopts
1019[docopt]: https://github.com/docopt/docopt.cpp
1020[gflags]: https://gflags.github.io/gflags
1021[getopt]: https://www.gnu.org/software/libc/manual/html_node/Getopt.html
1022[diana/hep]: http://diana-hep.org
1023[nsf award 1414736]: https://nsf.gov/awardsearch/showAward?AWD_ID=1414736
1024[university of cincinnati]: http://www.uc.edu
1025[gitbook]: https://cliutils.github.io/CLI11/book/
1026[cli11 advanced topics/custom converters]: https://cliutils.gitlab.io/CLI11Tutorial/chapters/advanced-topics.html#custom-converters
1027[programoptions.hxx]: https://github.com/Fytch/ProgramOptions.hxx
1028[argument aggregator]: https://github.com/vietjtnguyen/argagg
1029[args]: https://github.com/Taywee/args
1030[argh!]: https://github.com/adishavit/argh
1031[fmt]: https://github.com/fmtlib/fmt
1032[catch]: https://github.com/philsquared/Catch
1033[clara]: https://github.com/philsquared/Clara
1034[version 1.0 post]: https://iscinumpy.gitlab.io/post/announcing-cli11-10/
1035[version 1.3 post]: https://iscinumpy.gitlab.io/post/announcing-cli11-13/
1036[version 1.6 post]: https://iscinumpy.gitlab.io/post/announcing-cli11-16/
1037[wandbox-badge]: https://img.shields.io/badge/try_1.9-online-blue.svg
1038[wandbox-link]: https://wandbox.org/permlink/8SirASwhbFQZyDTW
1039[releases-badge]: https://img.shields.io/github/release/CLIUtils/CLI11.svg
1040[cli11-po-compare]: https://iscinumpy.gitlab.io/post/comparing-cli11-and-boostpo/
1041[diana slides]: https://indico.cern.ch/event/619465/contributions/2507949/attachments/1448567/2232649/20170424-diana-2.pdf
1042[awesome c++]: https://github.com/fffaraz/awesome-cpp/blob/master/README.md#cli
1043[cli]: https://codesynthesis.com/projects/cli/
1044[single file libs]: https://github.com/nothings/single_file_libs/blob/master/README.md
1045[codacy-badge]: https://api.codacy.com/project/badge/Grade/ac0df3aead2a4421b02070c3f324a0b9
1046[codacy-link]: https://www.codacy.com/app/henryiii/CLI11?utm_source=github.com&utm_medium=referral&utm_content=CLIUtils/CLI11&utm_campaign=Badge_Grade
1047[hunter]: https://docs.hunter.sh/en/latest/packages/pkg/CLI11.html
1048[standard readme style]: https://github.com/RichardLitt/standard-readme
1049[argparse]: https://github.com/p-ranav/argparse
1050