File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1389,7 +1389,7 @@ class App {
13891389 }
13901390 }
13911391
1392- // / Return True if a help flag detected (checks all parents)
1392+ // / Return True if a help flag detected (checks all parents) (only run if help called before subcommand)
13931393 bool _any_help_flag () const {
13941394 bool result = false ;
13951395 const Option *help_ptr = get_help_ptr ();
Original file line number Diff line number Diff line change @@ -438,6 +438,8 @@ struct SubcommandProgram : public TApp {
438438 int count;
439439
440440 SubcommandProgram () {
441+ app.set_help_all_flag (" --help-all" );
442+
441443 start = app.add_subcommand (" start" , " Start prog" );
442444 stop = app.add_subcommand (" stop" , " Stop prog" );
443445
@@ -541,6 +543,18 @@ TEST_F(SubcommandProgram, HelpOrder) {
541543 EXPECT_THROW (run (), CLI::CallForHelp);
542544}
543545
546+ TEST_F (SubcommandProgram, HelpAllOrder) {
547+
548+ args = {" --help-all" };
549+ EXPECT_THROW (run (), CLI::CallForAllHelp);
550+
551+ args = {" start" , " --help-all" };
552+ EXPECT_THROW (run (), CLI::CallForAllHelp);
553+
554+ args = {" --help-all" , " start" };
555+ EXPECT_THROW (run (), CLI::CallForAllHelp);
556+ }
557+
544558TEST_F (SubcommandProgram, Callbacks) {
545559
546560 start->callback ([]() { throw CLI::Success (); });
You can’t perform that action at this time.
0 commit comments