Closed nmoreaud closed 1 year ago
Ok so in fact it works, because is_subcommand_used
is set.
Ex:
try {
program.parse_args(m_argc, m_argv);
} catch (const std::runtime_error& err) {
std::cerr << err.what() << std::endl;
if (program.is_subcommand_used("clone")) {
std::cerr << clone_command;
} else {
std::cerr << program;
}
return 1;
}
It would be convenient to have access directly to used subcommand without having to test every subcommand name ; and to have access to more fields (ex m_program_name
could have a getter).
Unfortunately, this doesn't work with 'required' arguments. I think it would be necessary to have contextual help when required arguments are missing, currently it just prints what is required.
Hello,
With this example:
If I don't provide a clone url, the program prints:
I would expect to see:
What do you think about it? It behaves the same for required parameters, etc.