1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 20:23:55 +00:00

Adding case check for subcommand (simple)

This commit is contained in:
Henry Fredrick Schreiner 2017-02-20 13:23:05 -05:00
parent 196012a9f7
commit 4fca03d031
4 changed files with 28 additions and 3 deletions

View File

@ -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.

View File

@ -89,6 +89,7 @@ public:
parsed = false;
selected_subcommands.clear();
missing.clear();
for(const Option_p &opt : options) {
opt->clear();

View File

@ -162,7 +162,7 @@ TEST(RegEx, Longs) {
}
TEST(Regex, SplittingNew) {
TEST(RegEx, SplittingNew) {
std::vector<std::string> shorts;
std::vector<std::string> 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"));
}

View File

@ -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());
}