mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 13:44:12 +01:00
cli: fix top level --help combined with other options
If the top level --help is combined with other options, help fails. For example: $ notmuch --version --help Sorry, --help is not a known command. There's not much I can do to help. Fix this by adjusting argc and argv appropriately. The help command ignores argv[0] anyway, so we don't have to set it to "help".
This commit is contained in:
parent
c883e632bf
commit
c17e4fe629
1 changed files with 7 additions and 1 deletions
|
@ -315,7 +315,13 @@ main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print_help) {
|
if (print_help) {
|
||||||
ret = notmuch_help_command (NULL, argc - 1, &argv[1]);
|
/*
|
||||||
|
* Pass the first positional argument as argv[1] so the help
|
||||||
|
* command can give help for it. The help command ignores the
|
||||||
|
* argv[0] passed to it.
|
||||||
|
*/
|
||||||
|
ret = notmuch_help_command (NULL, argc - opt_index + 1,
|
||||||
|
argv + opt_index - 1);
|
||||||
goto DONE;
|
goto DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue