Commit 9690ef1b015f2c0c80246dfd50127c153e4d4c43
1 parent
467b0b13
Spelling fixes
Showing
1 changed file
with
5 additions
and
5 deletions
README.md
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | # CLI11: Command line parser for C++11 |
| 8 | 8 | |
| 9 | 9 | CLI11 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. |
| 10 | -It is tested on [Travis][travis-link] and [AppVeyor][appveyor-link], and is being included in the [GooFit GPU fitting framework][goofit-link]. It was inspired by [`plumbum.cli`][plumbum-link] for Python. It has both a user friendly introduction here, as well as [API documentation][api-docs] enerated by Travis. | |
| 10 | +It is tested on [Travis][travis-link] and [AppVeyor][appveyor-link], and is being included in the [GooFit GPU fitting framework][goofit-link]. It was inspired by [`plumbum.cli`][plumbum-link] for Python. CLI11 has both a user friendly introduction here, as well as [API documentation][api-docs] generated by Travis. | |
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | ### Why write another CLI parser? |
| ... | ... | @@ -161,7 +161,7 @@ everything after that is positional only. |
| 161 | 161 | |
| 162 | 162 | ## Subcommands |
| 163 | 163 | |
| 164 | -Subcommands are supported, and can be nested infinitly. 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. Children inherit the current setting from the parent. You cannot add multiple matching subcommand names at the same level (including ignore | |
| 164 | +Subcommands 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. Children inherit the current setting from the parent. You cannot add multiple matching subcommand names at the same level (including ignore | |
| 165 | 165 | case). |
| 166 | 166 | If you want to require 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. |
| 167 | 167 | |
| ... | ... | @@ -176,7 +176,7 @@ There are several options that are supported on the main app and subcommands. Th |
| 176 | 176 | * `.fallthrough()`: Allow extra unmatched options and positionals to "fall through" and be matched on a parent command. Subcommands always are allowed to fall through. |
| 177 | 177 | * `.require_subcommand()`: Require 1 or more subcommands. Accepts an integer argument to require an exact number of subcommands. |
| 178 | 178 | * `.add_subcommand(name, description="")` Add a subcommand, returns a pointer to the internally stored subcommand. |
| 179 | -* `.got_subcommand(App_or_name)`: Check to see if a subcommand was recieved on the command line | |
| 179 | +* `.got_subcommand(App_or_name)`: Check to see if a subcommand was received on the command line | |
| 180 | 180 | * `.get_subcommands()`: The list of subcommands given on the command line |
| 181 | 181 | * `.set_callback(void() function)`: Set the callback that runs at the end of parsing. The options have already run at this point. |
| 182 | 182 | * `.allow_extras()`: Do not throw an error if extra arguments are left over (Only useful on the main `App`, as that's the one that throws errors). |
| ... | ... | @@ -212,7 +212,7 @@ Spaces before and after the name and argument are ignored. Multiple arguments ar |
| 212 | 212 | ## Subclassing |
| 213 | 213 | |
| 214 | 214 | The App class was designed allow toolkits to subclass it, to provide default options 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`, but provides an option to disable it in the constructor (and in `add_subcommand`). 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 |
| 215 | -but before run behavoir, while | |
| 215 | +but before run behavior, while | |
| 216 | 216 | still giving the user freedom to `set_callback` on the main app. |
| 217 | 217 | |
| 218 | 218 | The 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. |
| ... | ... | @@ -222,7 +222,7 @@ Also, in a related note, the `App` you get a pointer to is stored in the parent |
| 222 | 222 | |
| 223 | 223 | ## How it works |
| 224 | 224 | |
| 225 | -Every `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 recieved (flags add empty strings to keep the counts correct). The lambda returns `true` if it could validate the option strings, and | |
| 225 | +Every `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 (flags add empty strings to keep the counts correct). The lambda returns `true` if it could validate the option strings, and | |
| 226 | 226 | `false` if it failed. |
| 227 | 227 | |
| 228 | 228 | ### Example | ... | ... |