diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c29b4b..598db6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Version 0.5 (in progress) -* `->ignore_case()` added to subcommands, options, and `add_set_ignore_case`. Subcommand inherit setting from parent App on creation. +* Throw `OptionAlreadyAdded` errors for matching subcommands or options, with ignore-case included, tests +* `->ignore_case()` added to subcommands, options, and `add_set_ignore_case`. Subcommands inherit setting from parent App on creation. * Subcommands now can be "chained", that is, left over arguments can now include subcommands that then get parsed. Subcommands are now a list (`get_subcommands`). Added `got_subcommand(App_or_name)` to check for subcommands. * Added `.allow_extras()` to disable error on failure. Parse returns a vector of leftover options. Renamed error to `ExtrasError`, and now triggers on extra options too. * Added `require_subcommand` to `App`, to simplify forcing subcommands. Do **not** do `add_subcommand()->require_subcommand`, since that is the subcommand, not the master `App`. diff --git a/README.md b/README.md index e1ee44f8..cefc90b9 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ This library was built to supply the Application object for the GooFit CUDA/OMP * Collect user feedback * Ini configuration support is basic (long options only, no vector support), is more needed? * Evaluate compatibility with [ROOT](https://root.cern.ch)'s TApplication object. -* Throw error if `ignore_case` causes non-unique matches See the [changelog](./CHANGELOG.md) or [GitHub releases](https://github.com/henryiii/CLI11/releases) for details. @@ -158,7 +157,7 @@ everything after that is positional only. ## Subcommands -Subcommands are naturally supported, with an infinite depth. 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. +Subcommands are naturally supported, with an infinite depth. 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 case). All `App`s have a `get_subcommands()` method, which returns a list of pointers to the subcommand passed on the command line. A simple compare of these pointers to each subcommand allows choosing based on subcommand, facilitated by a `got_subcommand(App_or_name) method that will check the list for you. For many cases, however, using an app's callback may be easier. Every app executes a callback function after it parses; just use a lambda function (with capture to get parsed values) to `.add_callback`. If you throw `CLI::Success`, you can even exit the program through the callback. The main `App` has a callback slot, as well, but it is generally not as useful. diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index c8c0ca91..68fd8118 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -31,7 +31,6 @@ enum class Classifer {NONE, POSITIONAL_MARK, SHORT, LONG, SUBCOMMAND}; class App; -typedef std::unique_ptr