File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -993,7 +993,7 @@ class App {
993993 // / creates an option group as part of the given app
994994 template <typename T = Option_group>
995995 T *add_option_group (std::string group_name, std::string group_description = " " ) {
996- auto option_group = std::make_shared<T>(std::move (group_description), group_name, nullptr );
996+ auto option_group = std::make_shared<T>(std::move (group_description), group_name, this );
997997 auto ptr = option_group.get ();
998998 // move to App_p for overload resolution on older gcc versions
999999 App_p app_ptr = std::dynamic_pointer_cast<App>(option_group);
Original file line number Diff line number Diff line change @@ -374,6 +374,18 @@ TEST_F(TApp, InvalidOptions) {
374374 EXPECT_THROW (ogroup->add_option (opt), CLI::OptionNotFound);
375375}
376376
377+ TEST_F (TApp, OptionGroupInheritedOptionDefaults) {
378+ app.option_defaults ()->ignore_case ();
379+ auto ogroup = app.add_option_group (" clusters" );
380+ int res{0 };
381+ ogroup->add_option (" --test1" , res);
382+
383+ args = {" --Test1" , " 5" };
384+ run ();
385+ EXPECT_EQ (res, 5 );
386+ EXPECT_EQ (app.count_all (), 1u );
387+ }
388+
377389struct ManyGroups : public TApp {
378390
379391 CLI::Option_group *main{nullptr };
You can’t perform that action at this time.
0 commit comments