Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 0D3B46DE0B36 for ; Mon, 15 Jun 2015 08:47:52 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.191 X-Spam-Level: X-Spam-Status: No, score=0.191 tagged_above=-999 required=5 tests=[AWL=0.181, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0MzBInF0e3w1 for ; Mon, 15 Jun 2015 08:47:49 -0700 (PDT) Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net [87.98.215.224]) by arlo.cworth.org (Postfix) with ESMTPS id 8C29D6DE0924 for ; Mon, 15 Jun 2015 08:47:49 -0700 (PDT) Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim 4.80) (envelope-from ) id 1Z4WbJ-0003P0-So; Mon, 15 Jun 2015 15:47:05 +0000 Received: (nullmailer pid 17207 invoked by uid 1000); Mon, 15 Jun 2015 15:46:52 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] cli: enable notmuch --help command Date: Mon, 15 Jun 2015 17:46:44 +0200 Message-Id: <1434383204-17152-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.1.4 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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: Mon, 15 Jun 2015 15:47:52 -0000 This functionality seems to have been undocumented, if it ever existed. Document it now. --- doc/man1/notmuch.rst | 4 +++- notmuch.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/man1/notmuch.rst b/doc/man1/notmuch.rst index ae0461a..87fb7bc 100644 --- a/doc/man1/notmuch.rst +++ b/doc/man1/notmuch.rst @@ -39,8 +39,10 @@ OPTIONS Supported global options for ``notmuch`` include - ``--help`` + ``--help`` [command-name] Print a synopsis of available commands and exit. + With an optional command name, show the man page + for that subcommand. ``--version`` Print the installed version of notmuch, and exit. diff --git a/notmuch.c b/notmuch.c index c528dce..9580c3f 100644 --- a/notmuch.c +++ b/notmuch.c @@ -381,11 +381,11 @@ main (int argc, char *argv[]) goto DONE; } - notmuch_process_shared_options (NULL); - if (opt_index < argc) command_name = argv[opt_index]; + notmuch_process_shared_options (command_name); + command = find_command (command_name); if (!command) { fprintf (stderr, "Error: Unknown command '%s' (see \"notmuch help\")\n", -- 2.1.4