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 {
1389
1389
}
1390
1390
}
1391
1391
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)
1393
1393
bool _any_help_flag () const {
1394
1394
bool result = false ;
1395
1395
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 {
438
438
int count;
439
439
440
440
SubcommandProgram () {
441
+ app.set_help_all_flag (" --help-all" );
442
+
441
443
start = app.add_subcommand (" start" , " Start prog" );
442
444
stop = app.add_subcommand (" stop" , " Stop prog" );
443
445
@@ -541,6 +543,18 @@ TEST_F(SubcommandProgram, HelpOrder) {
541
543
EXPECT_THROW (run (), CLI::CallForHelp);
542
544
}
543
545
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
+
544
558
TEST_F (SubcommandProgram, Callbacks) {
545
559
546
560
start->callback ([]() { throw CLI::Success (); });
You can’t perform that action at this time.
0 commit comments