From: Jani Nikula Date: Sun, 8 Mar 2015 16:18:55 +0000 (+0200) Subject: [PATCH 2/2] cli: add support for notmuch command --help X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5ae8ac5106cbf75f80103276a19203ab017674d1;p=notmuch-archives.git [PATCH 2/2] cli: add support for notmuch command --help --- diff --git a/f7/d1ed12802aba4009356febd53cf4a9ffe8b541 b/f7/d1ed12802aba4009356febd53cf4a9ffe8b541 new file mode 100644 index 000000000..83a293931 --- /dev/null +++ b/f7/d1ed12802aba4009356febd53cf4a9ffe8b541 @@ -0,0 +1,95 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id A4839431FD9 + for ; Sun, 8 Mar 2015 09:18:47 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.738 +X-Spam-Level: * +X-Spam-Status: No, score=1.738 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id n6m7GNhMb4bQ for ; + Sun, 8 Mar 2015 09:18:44 -0700 (PDT) +Received: from mail-we0-f171.google.com (mail-we0-f171.google.com + [74.125.82.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 44837431FBD + for ; Sun, 8 Mar 2015 09:18:44 -0700 (PDT) +Received: by wesw62 with SMTP id w62so6316149wes.0 + for ; Sun, 08 Mar 2015 09:18:43 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references; + bh=42rGcw44qdL8cCU5YS4fALBEZVdfowo2nTW0Vvih5J4=; + b=US6wo09fsWO+kdA8qPb1b0WqDhCevwu7wwG2Mh1QSZ/sLM70gHIIV+fPThV9zDIlfi + rytPTjMUE7qJHHMKZePxtb8AKCQG+65soXfn8iZr6BqwNkOgFAynWuOWdk2VZD9BswgA + /CxpoqAvLhShrZrbdhIYXHJFDvBnD8ZlZQlxQOYNmJ3H+2Njdy6+oYlgduHWF6N/D5VQ + EjcfdA9En7Ozjh6vI2EmqY13PYRq+gr6XFXsPL3pP85IAt7vuSZC3uNquK+WAiiASeiG + wMMaHY4q95vUgR4TJGzyHvxRrP0FuK0g/h6QM1yGXqY5sWBsML2OEPsgEmCWgMPXyjIb + EbSQ== +X-Gm-Message-State: + ALoCoQmai43zbgH8Xo+GIhu66rE3FTzTxL/nXrj9YMBwq/yGQtcHWqfscKc390IVtHVbWFNuJ/lH +X-Received: by 10.194.223.103 with SMTP id qt7mr47474148wjc.35.1425831523269; + Sun, 08 Mar 2015 09:18:43 -0700 (PDT) +Received: from localhost (mobile-internet-bcee3b-76.dhcp.inet.fi. + [188.238.59.76]) by mx.google.com with ESMTPSA id + y14sm24336045wjr.39.2015.03.08.09.18.40 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 08 Mar 2015 09:18:41 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] cli: add support for notmuch command --help +Date: Sun, 8 Mar 2015 18:18:55 +0200 +Message-Id: <1425831535-15920-2-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <1425831535-15920-1-git-send-email-jani@nikula.org> +References: <1425831535-15920-1-git-send-email-jani@nikula.org> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 08 Mar 2015 16:18:47 -0000 + +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 +