--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 3055E6DE1983\r
+ for <notmuch@notmuchmail.org>; Tue, 7 Apr 2015 00:23:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.492\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.492 tagged_above=-999 required=5 tests=[AWL=0.156,\r
+ DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2,\r
+ RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ RP_MATCHES_RCVD=-0.55, T_FREEMAIL_FORGED_FROMDOMAIN=0.01,\r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id gi-WQHLloL3p for <notmuch@notmuchmail.org>;\r
+ Tue, 7 Apr 2015 00:23:02 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id DA6916DE1974\r
+ for <notmuch@notmuchmail.org>; Tue, 7 Apr 2015 00:23:01 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YfNqb-0005ql-Gl; Tue, 07 Apr 2015 08:22:57 +0100\r
+Received: from 188.29.19.158.threembb.co.uk ([188.29.19.158] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YfNqa-0006zr-Bv; Tue, 07 Apr 2015 08:22:57 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Bremner <david@tethera.net>, David Bremner <david@tethera.net>,\r
+ notmuch@notmuchmail.org\r
+Subject: Re: [Patch v2 3/4] cli: define shared options,\r
+ use for --help and --version\r
+In-Reply-To: <1428322958-2887-4-git-send-email-david@tethera.net>\r
+References: <87d23ixnr7.fsf@maritornes.cs.unb.ca>\r
+ <1428322958-2887-1-git-send-email-david@tethera.net>\r
+ <1428322958-2887-4-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 07 Apr 2015 08:22:50 +0100\r
+Message-ID: <87y4m4qu5x.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-QM-SPAM-Info: 188.29.19.158 is in Janet mirror of Spamhaus XBL;\r
+ see http://www.spamhaus.org/xbl/\r
+X-Sender-Host-Address: 188.29.19.158\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 420765bb4dc25d03f3d2e0ecd0cc0485 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider\r
+ * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+ * -0.1 AWL AWL: Adjusted score from AWL reputation of From: address\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 07 Apr 2015 07:23:04 -0000\r
+\r
+\r
+Hi\r
+\r
+> +void notmuch_process_shared_options (const char* help_name);\r
+> diff --git a/notmuch.c b/notmuch.c\r
+\r
+> +/* any subcommand wanting to support these options should call\r
+> + * inherit notmuch_shared_options and call\r
+> + * notmuch_process_shared_options (subcommand_name);\r
+> + */\r
+> +void\r
+> +notmuch_process_shared_options (const char *help_name) {\r
+\r
+Perhaps call the argument something else as it might be used by other\r
+commands later? Eg subcommand_name? (and in notmuch-client.h too)\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+\r
+> + if (print_version) {\r
+> + printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");\r
+> + exit (EXIT_SUCCESS);\r
+> + }\r
+> +\r
+> + if (print_help) {\r
+> + int ret = _help_for (help_name);\r
+> + exit (ret);\r
+> + }\r
+> +}\r
+> +\r
+> +\r
+> static command_t commands[] = {\r
+> { NULL, notmuch_command, TRUE,\r
+> "Notmuch main command." },\r
+> @@ -295,14 +324,12 @@ main (int argc, char *argv[])\r
+> command_t *command;\r
+> char *config_file_name = NULL;\r
+> notmuch_config_t *config = NULL;\r
+> - notmuch_bool_t print_help=FALSE, print_version=FALSE;\r
+> int opt_index;\r
+> int ret;\r
+> \r
+> notmuch_opt_desc_t options[] = {\r
+> - { NOTMUCH_OPT_BOOLEAN, &print_help, "help", 'h', 0 },\r
+> - { NOTMUCH_OPT_BOOLEAN, &print_version, "version", 'v', 0 },\r
+> { NOTMUCH_OPT_STRING, &config_file_name, "config", 'c', 0 },\r
+> + { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },\r
+> { 0, 0, 0, 0, 0 }\r
+> };\r
+> \r
+> @@ -324,24 +351,7 @@ main (int argc, char *argv[])\r
+> goto DONE;\r
+> }\r
+> \r
+> - /* Handle notmuch --help [command] and notmuch command --help. */\r
+> - if (print_help ||\r
+> - (opt_index + 1 < argc && strcmp (argv[opt_index + 1], "--help") == 0)) {\r
+> - /*\r
+> - * Pass the first positional argument as argv[1] so the help\r
+> - * command can give help for it. The help command ignores the\r
+> - * argv[0] passed to it.\r
+> - */\r
+> - ret = notmuch_help_command (NULL, argc - opt_index + 1,\r
+> - argv + opt_index - 1);\r
+> - goto DONE;\r
+> - }\r
+> -\r
+> - if (print_version) {\r
+> - printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");\r
+> - ret = EXIT_SUCCESS;\r
+> - goto DONE;\r
+> - }\r
+> + notmuch_process_shared_options (NULL);\r
+> \r
+> if (opt_index < argc)\r
+> command_name = argv[opt_index];\r
+> -- \r
+> 2.1.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r