diff --git a/README.md b/README.md index 5c9f0e43..9a0d7e07 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,9 @@ This library was built to supply the Application object for the GooFit CUDA/OMP * 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. * Add tests: Add way for subclasses to return remaining options rather than throwing error -* Chained subcommands are not supported, once a subcommand is given the rest of the options go to that subcommand, rather than allowing multiple subcommands. This is currently intentional behavior, but multiple base level subcommands, like [`Click`](http://click.pocoo.org) supports, might be considered in the future. -* Support case insensitive set and/or subcommands? +* Chained subcommands are not tested, once a subcommand is given the rest of the options go to that subcommand, rather than allowing multiple subcommands. This is currently intentional behavior, but multiple base level subcommands, like [`Click`](http://click.pocoo.org) supports, might be considered in the future. +* Test and refine support for case insensitive set and/or subcommands? +* 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. diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index 21c0dcce..c501b7e2 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -89,6 +89,7 @@ public: parsed = false; selected_subcommands.clear(); + missing.clear(); for(const Option_p &opt : options) { opt->clear(); diff --git a/tests/HelpersTest.cpp b/tests/HelpersTest.cpp index eba88c18..66048dea 100644 --- a/tests/HelpersTest.cpp +++ b/tests/HelpersTest.cpp @@ -162,7 +162,7 @@ TEST(RegEx, Longs) { } -TEST(Regex, SplittingNew) { +TEST(RegEx, SplittingNew) { std::vector shorts; std::vector longs; @@ -183,3 +183,8 @@ TEST(Regex, SplittingNew) { EXPECT_THROW(std::tie(shorts, longs, pname) = CLI::detail::get_names({"one","two"}), CLI::BadNameString); } + +TEST(String, ToLower) { + + EXPECT_EQ("one and two", CLI::detail::to_lower("one And TWO")); +} diff --git a/tests/SubcommandTest.cpp b/tests/SubcommandTest.cpp index 632b9c2c..4756619e 100644 --- a/tests/SubcommandTest.cpp +++ b/tests/SubcommandTest.cpp @@ -98,4 +98,22 @@ TEST_F(SubcommandProgram, SpareSub) { EXPECT_THROW(run(), CLI::ExtrasError); } +TEST_F(SubcommandProgram, CaseCheck) { + args = {"Start"}; + EXPECT_THROW(run(), CLI::ExtrasError); + + + app.reset(); + args = {"start"}; + EXPECT_NO_THROW(run()); + + + app.reset(); + start->ignore_case(); + EXPECT_NO_THROW(run()); + + app.reset(); + args = {"Start"}; + EXPECT_NO_THROW(run()); +}