1 Return-Path: <novalazy@gmail.com>
\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 olra.theworths.org (Postfix) with ESMTP id 96B1E431FB6
\r
6 for <notmuch@notmuchmail.org>; Sat, 26 May 2012 19:33:02 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id KvxIS+UkP-g6 for <notmuch@notmuchmail.org>;
\r
17 Sat, 26 May 2012 19:33:00 -0700 (PDT)
\r
18 Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com
\r
19 [209.85.160.53]) (using TLSv1 with cipher RC4-MD5 (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 669E3431FAF
\r
22 for <notmuch@notmuchmail.org>; Sat, 26 May 2012 19:33:00 -0700 (PDT)
\r
23 Received: by pbbrr13 with SMTP id rr13so4009919pbb.26
\r
24 for <notmuch@notmuchmail.org>; Sat, 26 May 2012 19:32:59 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=date:message-id:from:to:subject:in-reply-to:references:mime-version
\r
27 :content-type:content-disposition:content-transfer-encoding;
\r
28 bh=Q5Md19suo1Z8i6GVONL+GJqDpUlMAXw/Dt7aKmwj1lQ=;
\r
29 b=FOox/St+AugHXGKEid+/yv5QKsIrMnZ/lzbz06Vxz2oEW+QbZ21gPnhNJNOcTGQkMr
\r
30 O/JI7DlD2bYhHeyLGtHkjdSCZjjKdgzwp4CmG4fKw1ObweoPOK2u7LwOQEKWi4g9KlR9
\r
31 InxCvAT+9ZCRbFJw0VZXVyIYxeONpkZPGUUE1Z+AsmOYMZoJ43eugXqRiidJSvl0aSB8
\r
32 n0x9IrsD9sY9fLmyOlrBG3h/afrkm1eOOBrKhRItRi7n6ef1B8SqzmWIw+xYl/I4znYK
\r
33 dx9IaOEeNA69BBoxc0Fqy4PhVnbjsBRNmcQPhRc4dcxGbYEFaKthHly5lygmNgzt7QAP
\r
35 Received: by 10.68.226.73 with SMTP id rq9mr12743599pbc.145.1338085979578;
\r
36 Sat, 26 May 2012 19:32:59 -0700 (PDT)
\r
37 Received: from localhost (215.42.233.220.static.exetel.com.au.
\r
39 by mx.google.com with ESMTPS id rj4sm14338466pbc.30.2012.05.26.19.32.56
\r
40 (version=TLSv1/SSLv3 cipher=OTHER);
\r
41 Sat, 26 May 2012 19:32:57 -0700 (PDT)
\r
42 Date: Sun, 27 May 2012 12:32:53 +1000
\r
43 Message-ID: <20120527123253.GA3049@hili.localdomain>
\r
44 From: Peter Wang <novalazy@gmail.com>
\r
45 To: notmuch@notmuchmail.org
\r
46 Subject: Re: [PATCH v5 1/5] cli: command line parsing: allow default for
\r
48 In-Reply-To: <1338047694-32548-2-git-send-email-markwalters1009@gmail.com>
\r
49 References: <1338047694-32548-1-git-send-email-markwalters1009@gmail.com>
\r
50 <1338047694-32548-2-git-send-email-markwalters1009@gmail.com>
\r
52 Content-Type: text/plain; charset=utf-8
\r
53 Content-Disposition: inline
\r
54 Content-Transfer-Encoding: 8bit
\r
55 X-BeenThere: notmuch@notmuchmail.org
\r
56 X-Mailman-Version: 2.1.13
\r
58 List-Id: "Use and development of the notmuch mail system."
\r
59 <notmuch.notmuchmail.org>
\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
63 List-Post: <mailto:notmuch@notmuchmail.org>
\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
67 X-List-Received-Date: Sun, 27 May 2012 02:33:02 -0000
\r
69 On Sat, 26 May 2012 16:54:50 +0100, Mark Walters <markwalters1009@gmail.com> wrote:
\r
70 > This changes the parsing for "keyword" options so that if the option
\r
71 > is specified with no argument the first possible argument is
\r
72 > chosen. This make it easier to add options to existing boolean
\r
73 > arguments (the existing --option can default to TRUE).
\r
75 This has the side-effect of allowing defaults for all keyword options,
\r
76 right? I'm not sure that's desirable when the default is non-obvious.
\r
78 Maybe keyword options which allow an optional argument should have an
\r
79 explicit entry in the notmuch_keyword_t[] array, e.g. under "" or "default".
\r
81 > diff --git a/command-line-arguments.c b/command-line-arguments.c
\r
82 > index 76b185f..d40c7e6 100644
\r
83 > --- a/command-line-arguments.c
\r
84 > +++ b/command-line-arguments.c
\r
85 > @@ -11,10 +11,16 @@
\r
88 > static notmuch_bool_t
\r
89 > -_process_keyword_arg (const notmuch_opt_desc_t *arg_desc, const char *arg_str) {
\r
90 > +_process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
\r
92 > const notmuch_keyword_t *keywords = arg_desc->keywords;
\r
94 > + if (next == 0) {
\r
95 > +/* No keyword given so return first option as default */
\r
96 > + *((int *)arg_desc->output_var) = keywords->value;
\r