1 Return-Path: <m.walters@qmul.ac.uk>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 3055E6DE1983
\r
6 for <notmuch@notmuchmail.org>; Tue, 7 Apr 2015 00:23:04 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-1.492 tagged_above=-999 required=5 tests=[AWL=0.156,
\r
12 DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2,
\r
13 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
\r
14 RP_MATCHES_RCVD=-0.55, T_FREEMAIL_FORGED_FROMDOMAIN=0.01,
\r
15 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
16 Received: from arlo.cworth.org ([127.0.0.1])
\r
17 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
18 with ESMTP id gi-WQHLloL3p for <notmuch@notmuchmail.org>;
\r
19 Tue, 7 Apr 2015 00:23:02 -0700 (PDT)
\r
20 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id DA6916DE1974
\r
22 for <notmuch@notmuchmail.org>; Tue, 7 Apr 2015 00:23:01 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1YfNqb-0005ql-Gl; Tue, 07 Apr 2015 08:22:57 +0100
\r
27 Received: from 188.29.19.158.threembb.co.uk ([188.29.19.158] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1YfNqa-0006zr-Bv; Tue, 07 Apr 2015 08:22:57 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: David Bremner <david@tethera.net>, David Bremner <david@tethera.net>,
\r
33 notmuch@notmuchmail.org
\r
34 Subject: Re: [Patch v2 3/4] cli: define shared options,
\r
35 use for --help and --version
\r
36 In-Reply-To: <1428322958-2887-4-git-send-email-david@tethera.net>
\r
37 References: <87d23ixnr7.fsf@maritornes.cs.unb.ca>
\r
38 <1428322958-2887-1-git-send-email-david@tethera.net>
\r
39 <1428322958-2887-4-git-send-email-david@tethera.net>
\r
40 User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1
\r
41 (x86_64-pc-linux-gnu)
\r
42 Date: Tue, 07 Apr 2015 08:22:50 +0100
\r
43 Message-ID: <87y4m4qu5x.fsf@qmul.ac.uk>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 X-QM-SPAM-Info: 188.29.19.158 is in Janet mirror of Spamhaus XBL;
\r
47 see http://www.spamhaus.org/xbl/
\r
48 X-Sender-Host-Address: 188.29.19.158
\r
49 X-QM-Geographic: According to ripencc,
\r
50 this message was delivered by a machine in Britain (UK) (GB).
\r
51 X-QM-SPAM-Info: Sender has good ham record. :)
\r
52 X-QM-Body-MD5: 420765bb4dc25d03f3d2e0ecd0cc0485 (of first 20000 bytes)
\r
53 X-SpamAssassin-Score: -0.1
\r
54 X-SpamAssassin-SpamBar: /
\r
55 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
57 spam. We require at least 5.0 points to mark a message as spam.
\r
58 This message scored -0.1 points.
\r
59 Summary of the scoring:
\r
60 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
\r
61 * (markwalters1009[at]gmail.com)
\r
62 * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
\r
64 * -0.1 AWL AWL: Adjusted score from AWL reputation of From: address
\r
65 X-QM-Scan-Virus: ClamAV says the message is clean
\r
66 X-BeenThere: notmuch@notmuchmail.org
\r
67 X-Mailman-Version: 2.1.18
\r
69 List-Id: "Use and development of the notmuch mail system."
\r
70 <notmuch.notmuchmail.org>
\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
74 List-Post: <mailto:notmuch@notmuchmail.org>
\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
77 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
78 X-List-Received-Date: Tue, 07 Apr 2015 07:23:04 -0000
\r
83 > +void notmuch_process_shared_options (const char* help_name);
\r
84 > diff --git a/notmuch.c b/notmuch.c
\r
86 > +/* any subcommand wanting to support these options should call
\r
87 > + * inherit notmuch_shared_options and call
\r
88 > + * notmuch_process_shared_options (subcommand_name);
\r
91 > +notmuch_process_shared_options (const char *help_name) {
\r
93 Perhaps call the argument something else as it might be used by other
\r
94 commands later? Eg subcommand_name? (and in notmuch-client.h too)
\r
103 > + if (print_version) {
\r
104 > + printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
\r
105 > + exit (EXIT_SUCCESS);
\r
108 > + if (print_help) {
\r
109 > + int ret = _help_for (help_name);
\r
115 > static command_t commands[] = {
\r
116 > { NULL, notmuch_command, TRUE,
\r
117 > "Notmuch main command." },
\r
118 > @@ -295,14 +324,12 @@ main (int argc, char *argv[])
\r
119 > command_t *command;
\r
120 > char *config_file_name = NULL;
\r
121 > notmuch_config_t *config = NULL;
\r
122 > - notmuch_bool_t print_help=FALSE, print_version=FALSE;
\r
126 > notmuch_opt_desc_t options[] = {
\r
127 > - { NOTMUCH_OPT_BOOLEAN, &print_help, "help", 'h', 0 },
\r
128 > - { NOTMUCH_OPT_BOOLEAN, &print_version, "version", 'v', 0 },
\r
129 > { NOTMUCH_OPT_STRING, &config_file_name, "config", 'c', 0 },
\r
130 > + { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },
\r
131 > { 0, 0, 0, 0, 0 }
\r
134 > @@ -324,24 +351,7 @@ main (int argc, char *argv[])
\r
138 > - /* Handle notmuch --help [command] and notmuch command --help. */
\r
139 > - if (print_help ||
\r
140 > - (opt_index + 1 < argc && strcmp (argv[opt_index + 1], "--help") == 0)) {
\r
142 > - * Pass the first positional argument as argv[1] so the help
\r
143 > - * command can give help for it. The help command ignores the
\r
144 > - * argv[0] passed to it.
\r
146 > - ret = notmuch_help_command (NULL, argc - opt_index + 1,
\r
147 > - argv + opt_index - 1);
\r
151 > - if (print_version) {
\r
152 > - printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
\r
153 > - ret = EXIT_SUCCESS;
\r
156 > + notmuch_process_shared_options (NULL);
\r
158 > if (opt_index < argc)
\r
159 > command_name = argv[opt_index];
\r
163 > _______________________________________________
\r
164 > notmuch mailing list
\r
165 > notmuch@notmuchmail.org
\r
166 > http://notmuchmail.org/mailman/listinfo/notmuch
\r