Re: argument parsing refactoring, round 2
[notmuch-archives.git] / 93 / f87cabca63b6516f8e19503d1f1bbbbb3d1efc
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 BDCC46DE1978\r
6  for <notmuch@notmuchmail.org>; Tue,  7 Apr 2015 00:19:37 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.268\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.268 tagged_above=-999 required=5 tests=[AWL=1.916, \r
12  DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13  NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3,\r
14  RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
15  RP_MATCHES_RCVD=-0.55, T_FREEMAIL_FORGED_FROMDOMAIN=0.01,\r
16  T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
17 Received: from arlo.cworth.org ([127.0.0.1])\r
18  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
19  with ESMTP id xX9nkKyIzjhd for <notmuch@notmuchmail.org>;\r
20  Tue,  7 Apr 2015 00:19:35 -0700 (PDT)\r
21 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
22  by arlo.cworth.org (Postfix) with ESMTPS id 04A036DE1974\r
23  for <notmuch@notmuchmail.org>; Tue,  7 Apr 2015 00:19:34 -0700 (PDT)\r
24 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
25  by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
26  (envelope-from <m.walters@qmul.ac.uk>)\r
27  id 1YfNnC-0004o2-Kq; Tue, 07 Apr 2015 08:19:29 +0100\r
28 Received: from 188.29.19.158.threembb.co.uk ([188.29.19.158] helo=localhost)\r
29  by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
30  (envelope-from <m.walters@qmul.ac.uk>)\r
31  id 1YfNnB-00065R-GX; Tue, 07 Apr 2015 08:19:26 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: David Bremner <david@tethera.net>, David Bremner <david@tethera.net>,\r
34  notmuch@notmuchmail.org\r
35 Subject: Re: argument parsing refactoring, round 2\r
36 In-Reply-To: <1428322958-2887-1-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 User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
40  (x86_64-pc-linux-gnu)\r
41 Date: Tue, 07 Apr 2015 08:19:19 +0100\r
42 Message-ID: <871tjws8w8.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-QM-SPAM-Info: 188.29.19.158 is in Janet mirror of Spamhaus XBL;\r
46  see http://www.spamhaus.org/xbl/\r
47 X-Sender-Host-Address: 188.29.19.158\r
48 X-QM-Geographic: According to ripencc,\r
49  this message was delivered by a machine in Britain (UK) (GB).\r
50 X-QM-SPAM-Info: Sender has good ham record.  :)\r
51 X-QM-Body-MD5: 9e5abac1c37783f5f6ec2574cb490661 (of first 20000 bytes)\r
52 X-SpamAssassin-Score: -0.0\r
53 X-SpamAssassin-SpamBar: /\r
54 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
55  determine if it is\r
56  spam. We require at least 5.0 points to mark a message as spam.\r
57  This message scored -0.0 points.\r
58  Summary of the scoring: \r
59  *  0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider\r
60  *      (markwalters1009[at]gmail.com)\r
61  * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
62  *      domain\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.18\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68  <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Tue, 07 Apr 2015 07:19:37 -0000\r
77 \r
78 \r
79 On Mon, 06 Apr 2015, David Bremner <david@tethera.net> wrote:\r
80 > Thanks to Mark for pointing out on IRC that the previous version had problems linking the test suite helpers. That's fixed here by adding a couple stubs.\r
81 >\r
82 > Here's the diff, roughly with the previous version (actually the first\r
83 > hunk is with a slightly later version, where I fixed one bug and\r
84 > introduced another).\r
85 \r
86 Hi \r
87 \r
88 I like the shared options and the series in general. I have some very\r
89 minor nits:\r
90 \r
91 The first is that I think you missed the second command in\r
92 notmuch-search.c: i.e., notmuch_address_command so that doesn't respect\r
93 these options. (You could either just add it there or to common_options\r
94 if you prefer)\r
95 \r
96 The second is utterly trivial: is it worth having the shared options for\r
97 help too? At the moment notmuch help --help just says "sorry --help is\r
98 not a command".\r
99 \r
100 The other (very minor things) I will send in replies to the individual\r
101 patches.\r
102 \r
103 Best wishes\r
104 \r
105 Mark\r
106 \r
107 \r
108 >\r
109 > diff --git a/notmuch-config.c b/notmuch-config.c\r
110 > index 568b3dc..f2cd6a8 100644\r
111 > --- a/notmuch-config.c\r
112 > +++ b/notmuch-config.c\r
113 > @@ -885,9 +885,9 @@ notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])\r
114 >  \r
115 >      notmuch_process_shared_options (argv[0]);\r
116 >  \r
117 > -    /* skip subcommand argument */\r
118 > -    argc-= opt_index+1;\r
119 > -    argv+= opt_index+1;\r
120 > +    /* skip at least subcommand argument */\r
121 > +    argc-= opt_index;\r
122 > +    argv+= opt_index;\r
123 >  \r
124 >      if (argc < 1) {\r
125 >       fprintf (stderr, "Error: notmuch config requires at least one argument.\n");\r
126 > diff --git a/notmuch-setup.c b/notmuch-setup.c\r
127 > index 5fc6e25..6a020dc 100644\r
128 > --- a/notmuch-setup.c\r
129 > +++ b/notmuch-setup.c\r
130 > @@ -155,7 +155,7 @@ notmuch_setup_command (notmuch_config_t *config,\r
131 >      if (opt_index < 0)\r
132 >       return EXIT_FAILURE;\r
133 >  \r
134 > -    notmuch_process_shared_options (argv[0]);\r
135 > +    notmuch_process_shared_options ("setup");\r
136 >  \r
137 >      if (notmuch_config_is_new (config))\r
138 >       welcome_message_pre_setup ();\r
139 > diff --git a/test/random-corpus.c b/test/random-corpus.c\r
140 > index 790193d..6c467bb 100644\r
141 > --- a/test/random-corpus.c\r
142 > +++ b/test/random-corpus.c\r
143 > @@ -114,6 +114,15 @@ random_utf8_string (void *ctx, size_t char_count)\r
144 >      return buf;\r
145 >  }\r
146 >  \r
147 > +/* stubs since we cannot link with notmuch.o */\r
148 > +const notmuch_opt_desc_t notmuch_shared_options[] = {\r
149 > +     { 0, 0, 0, 0, 0 }\r
150 > +};\r
151 > +\r
152 > +void\r
153 > +notmuch_process_shared_options (unused (const char *dummy))\r
154 > +{\r
155 > +}\r
156 >  \r
157 >  int\r
158 >  main (int argc, char **argv)\r
159 > _______________________________________________\r
160 > notmuch mailing list\r
161 > notmuch@notmuchmail.org\r
162 > http://notmuchmail.org/mailman/listinfo/notmuch\r