Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help-all flag is not removed from required options error message #527

Closed
jakoblover opened this issue Oct 22, 2020 · 0 comments
Closed

Help-all flag is not removed from required options error message #527

jakoblover opened this issue Oct 22, 2020 · 0 comments

Comments

@jakoblover
Copy link
Contributor

If x amount of options from a group is required, the help-all flag will be displayed in addition to the other options, while the normal help flag has been removed from the list. Help-all should also be removed from this list if set_help_all_flag() has been set

Output:

At least 1 option from [--help-all,.....]  is required
Run with --help or --help-all for more information.

Code that should be fixed resides in App.hpp

if(require_option_min_ > used_options || (require_option_max_ > 0 && require_option_max_ < used_options)) {
            auto option_list = detail::join(options_, [](const Option_p &ptr) { return ptr->get_name(false, true); });
            if(option_list.compare(0, 10, "-h,--help,") == 0) {
                option_list.erase(0, 10);
            }
            auto subc_list = get_subcommands([](App *app) { return ((app->get_name().empty()) && (!app->disabled_)); });
            if(!subc_list.empty()) {
                option_list += "," + detail::join(subc_list, [](const App *app) { return app->get_display_name(); });
            }
            throw RequiredError::Option(require_option_min_, require_option_max_, used_options, option_list);
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants