unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] cli: add support for notmuch command --help
Date: Sun,  8 Mar 2015 18:18:55 +0200	[thread overview]
Message-ID: <1425831535-15920-2-git-send-email-jani@nikula.org> (raw)
In-Reply-To: <1425831535-15920-1-git-send-email-jani@nikula.org>

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

  reply	other threads:[~2015-03-08 16:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08 16:18 [PATCH 1/2] cli: fix top level --help combined with other options Jani Nikula
2015-03-08 16:18 ` Jani Nikula [this message]
2015-03-09  7:14   ` [PATCH 2/2] cli: add support for notmuch command --help David Bremner
2015-03-10  8:06     ` Tomi Ollila
2015-03-09  7:06 ` [PATCH 1/2] cli: fix top level --help combined with other options David Bremner
2015-03-10  8:03   ` Tomi Ollila
2015-03-11  7:16 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425831535-15920-2-git-send-email-jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).