[PATCH 2/2] cli: add support for notmuch command --help

Jani Nikula jani at nikula.org
Sun Mar 8 09:18:55 PDT 2015


Recognize 'notmuch command --help' at the top level as a special case,
and show help for the command. Note that for simplicity, --help is
only recognized as the first option for the subcommand.

---

Creeping featurism or useful? ISTR Mark wanted this.
---
 notmuch.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/notmuch.c b/notmuch.c
index 1717e8b3683c..a5b2877aee09 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -314,7 +314,9 @@ main (int argc, char *argv[])
 	goto DONE;
     }
 
-    if (print_help) {
+    /* 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
-- 
2.1.4



More information about the notmuch mailing list