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)
That will generate that output:
If i don't pass
--host
or--guest
will not throw any problem. (cpp C:\conf.yml -o C:\Generated
)