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

add_mutually_exclusive_group required in parent parser are not validated #316

Open
CorrM opened this issue Dec 10, 2023 · 0 comments
Open

Comments

@CorrM
Copy link

CorrM commented Dec 10, 2023

argparse::ArgumentParser::MutuallyExclusiveGroup& syntaxGroup = genParser.add_mutually_exclusive_group(true);
    syntaxGroup.add_argument("--host")
            .help("Generate host syntax for target language.")
            .default_value(false)
            .implicit_value(true);
    syntaxGroup.add_argument("--guest")
            .help("Generate guest syntax for target language.")
            .default_value(false)
            .implicit_value(true);

    // Cpp
    argparse::ArgumentParser cppCommand("cpp");
    cppCommand.add_description("Generate C++ language SDK.");
    cppCommand.add_parents(genParser);

That will generate that output:

Positional arguments:
  CONFIG                 Configration file path. [required]

Optional arguments:
  -h, --help             shows help message and exits
  -v, --version          prints version information and exits
  -o, --output OUTPUT    Output directory path to store generated files. [required]
  --host                 Generate host syntax for target language.
  --guest                Generate guest syntax for target language.

If i don't pass --host or --guest will not throw any problem. (cpp C:\conf.yml -o C:\Generated)

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

1 participant