[llvm] [CommandLine] Better report unknown subcommands (PR #74811)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 8 00:07:55 PST 2023
================
@@ -2206,4 +2206,25 @@ TEST(CommandLineTest, DefaultValue) {
EXPECT_EQ(1, StrInitOption.getNumOccurrences());
}
+TEST(CommandLineTest, UnknownSubcommand) {
+ cl::ResetCommandLineParser();
+
+ StackSubCommand SC1("foo", "Foo subcommand");
+ StackSubCommand SC2("bar", "Bar subcommand");
+ StackOption<bool> SC1Opt("f", cl::sub(SC1));
+ StackOption<bool> SC2Opt("b", cl::sub(SC2));
+ StackOption<bool> TopOpt("t");
----------------
jh7370 wrote:
Perhaps worth adding a second top-level option to show that the right one is picked for the suggestion here too.
https://github.com/llvm/llvm-project/pull/74811
More information about the llvm-commits
mailing list