-
-
Notifications
You must be signed in to change notification settings - Fork 56
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 not working in sub-command example #23
Comments
Can you post what commands you tried and what you expected? |
I tried that nugget of code from the documentation: /* [insert definitions of run_command and kill_command here] */
int main(int argc, const char** argv)
{
auto cli = lyra::cli_parser();
std::string command;
bool show_help = false;
cli.add_argument(lyra::help(show_help));
cli.add_argument(lyra::arg(command, "command")
.choices(run_command::name(), kill_command::name())
.required()
.help("Command to perform."));
if (show_help)
{
std::cout << cli;
return 0;
}
auto result = cli.parse({ argc, argv });
/* ... */
} Then I tried to call the resulting program with I know that this specific example is not really about showing how to use |
Sorry it took a bit.. But it looks like this is a duplicate error report. It was fixed some time ago: 5657ff1 Thanks for reporting the problem and for using the library. |
Indeed, I apparently missed that one. Thanks for maintaining the library :) |
I was trying to get
lyra::help
to work with theadd_argument
interface and the sub-command example has just that. However, it looks like--help
is not working in this case. I got it to work by moving thecli.parse
invocation before the check forshow_help
- I believe that it's the right fix (parsing the command line for--help
before checking the corresponding flag makes sense to me) but it's my first time trying Lyra so I can't really be sure.I believe that it was introduced when implementing the fix for #16.
The text was updated successfully, but these errors were encountered: