X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.c;h=a5b2877aee09243044b960d6b3b1f833fbf091af;hp=0fac0997865e6acd8622707c49d2d29999d488e3;hb=76f8498df61577c2f2e8f22e34a93a37ea532a03;hpb=5c27136e64dab2f90995de0bfa37c54186a2fae1 diff --git a/notmuch.c b/notmuch.c index 0fac0997..a5b2877a 100644 --- a/notmuch.c +++ b/notmuch.c @@ -314,8 +314,16 @@ main (int argc, char *argv[]) goto DONE; } - if (print_help) { - ret = notmuch_help_command (NULL, argc - 1, &argv[1]); + /* Handle notmuch --help [command] and notmuch command --help. */ + if (print_help || + (opt_index + 1 < argc && strcmp (argv[opt_index + 1], "--help") == 0)) { + /* + * 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; }