]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.c
cli: fix top level --help combined with other options
[notmuch] / notmuch.c
index 0fac0997865e6acd8622707c49d2d29999d488e3..1717e8b3683c485e4652e37abc9886e13d2afa49 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -315,7 +315,13 @@ main (int argc, char *argv[])
     }
 
     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;
     }