You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
argparse::ArgumentParser program("test", "0.0.1");
argparse::ArgumentParser genParser("gen", "0.0.1", argparse::default_arguments::none);
genParser.add_argument("-c", "--config")
.help("Configration file path.")
.metavar("CONFIG")
.required();
// Cpp
argparse::ArgumentParser cppCommand("cpp");
cppCommand.add_description("Generate C++ language SDK.");
cppCommand.add_parents(genParser);
cppCommand.add_argument("--namespace")
.help("Set the C++ namespace for the generated SDK.")
.metavar("NAMESPACE")
.action([&properties](const std::string& value){ properties.emplace_back("namespace", value); });
program.add_subparser(cppCommand);
// CSharp
argparse::ArgumentParser csharpCommand("csharp");
csharpCommand.add_description("Generate C# language SDK.");
csharpCommand.add_parents(genParser);
program.add_subparser(csharpCommand);
// Python
argparse::ArgumentParser pythonCommand("python");
pythonCommand.add_description("Generate Python language SDK.");
pythonCommand.add_parents(genParser);
program.add_subparser(pythonCommand);
std::string configPath = program.get("-c"); // No such argument: -c
std::string configPath = genParser.get("-c"); // Nothing parsed, no arguments are available.
std::string configPath = cppCommand.get("-c"); // Work
when i debug, genParser have the the argument but argument field are not updated.
as workaround i could do some condition around is_subcommand_used but i think its not the correct way to do it.
The text was updated successfully, but these errors were encountered:
when i debug,
genParser
have the the argument but argument field are not updated.as workaround i could do some condition around
is_subcommand_used
but i think its not the correct way to do it.The text was updated successfully, but these errors were encountered: