mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 12:13:52 +00:00
Adding case check for subcommand (simple)
This commit is contained in:
parent
196012a9f7
commit
4fca03d031
@ -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?
|
* 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.
|
* 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
|
* 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.
|
* 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.
|
||||||
* Support case insensitive set and/or subcommands?
|
* 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.
|
See the [changelog](./CHANGELOG.md) or [GitHub releases](https://github.com/henryiii/CLI11/releases) for details.
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ public:
|
|||||||
|
|
||||||
parsed = false;
|
parsed = false;
|
||||||
selected_subcommands.clear();
|
selected_subcommands.clear();
|
||||||
|
missing.clear();
|
||||||
|
|
||||||
for(const Option_p &opt : options) {
|
for(const Option_p &opt : options) {
|
||||||
opt->clear();
|
opt->clear();
|
||||||
|
@ -162,7 +162,7 @@ TEST(RegEx, Longs) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Regex, SplittingNew) {
|
TEST(RegEx, SplittingNew) {
|
||||||
|
|
||||||
std::vector<std::string> shorts;
|
std::vector<std::string> shorts;
|
||||||
std::vector<std::string> longs;
|
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);
|
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"));
|
||||||
|
}
|
||||||
|
@ -98,4 +98,22 @@ TEST_F(SubcommandProgram, SpareSub) {
|
|||||||
EXPECT_THROW(run(), CLI::ExtrasError);
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user