1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 8284C6DE1B56
\r
6 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 14:34:32 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.619 tagged_above=-999 required=5 tests=[AWL=0.609,
\r
12 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id MwLFeG-cA7Us for <notmuch@notmuchmail.org>;
\r
16 Sun, 5 Apr 2015 14:34:30 -0700 (PDT)
\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net
\r
19 by arlo.cworth.org (Postfix) with ESMTPS id 674116DE1B51
\r
20 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 14:34:30 -0700 (PDT)
\r
21 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim
\r
22 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
23 id 1YerfA-0002Re-0Z; Sun, 05 Apr 2015 21:01:00 +0000
\r
24 Received: (nullmailer pid 29566 invoked by uid 1000); Sun, 05 Apr 2015
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: notmuch@notmuchmail.org
\r
28 Subject: [PATCH 4/4] cli: add standard option processing to config and setup
\r
29 Date: Mon, 6 Apr 2015 05:59:34 +0900
\r
30 Message-Id: <1428267574-28797-5-git-send-email-david@tethera.net>
\r
31 X-Mailer: git-send-email 2.1.4
\r
32 In-Reply-To: <1428267574-28797-1-git-send-email-david@tethera.net>
\r
33 References: <1428267574-28797-1-git-send-email-david@tethera.net>
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.18
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Sun, 05 Apr 2015 21:34:32 -0000
\r
48 In particular this fixes a recently encountered bug where the
\r
49 "--config" argument to "notmuch setup" is silently ignored, which the
\r
50 unpleasant consequence of overwriting the users config file.
\r
52 notmuch-config.c | 12 ++++++++++++
\r
53 notmuch-setup.c | 12 ++++++++++++
\r
54 2 files changed, 24 insertions(+)
\r
56 diff --git a/notmuch-config.c b/notmuch-config.c
\r
57 index 2d5c297..054dd3b 100644
\r
58 --- a/notmuch-config.c
\r
59 +++ b/notmuch-config.c
\r
60 @@ -872,6 +872,18 @@ int
\r
61 notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])
\r
66 + notmuch_opt_desc_t options[] = {
\r
67 + { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },
\r
71 + opt_index = parse_arguments (argc, argv, options, 1);
\r
72 + if (opt_index < 0)
\r
73 + return EXIT_FAILURE;
\r
75 + notmuch_process_shared_options (argv[0]);
\r
77 argc--; argv++; /* skip subcommand argument */
\r
79 diff --git a/notmuch-setup.c b/notmuch-setup.c
\r
80 index 36a6171..5fc6e25 100644
\r
81 --- a/notmuch-setup.c
\r
82 +++ b/notmuch-setup.c
\r
83 @@ -133,6 +133,7 @@ notmuch_setup_command (notmuch_config_t *config,
\r
84 size_t new_tags_len;
\r
85 const char **search_exclude_tags;
\r
86 size_t search_exclude_tags_len;
\r
89 #define prompt(format, ...) \
\r
91 @@ -145,6 +146,17 @@ notmuch_setup_command (notmuch_config_t *config,
\r
92 chomp_newline (response); \
\r
95 + notmuch_opt_desc_t options[] = {
\r
96 + { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },
\r
100 + opt_index = parse_arguments (argc, argv, options, 1);
\r
101 + if (opt_index < 0)
\r
102 + return EXIT_FAILURE;
\r
104 + notmuch_process_shared_options (argv[0]);
\r
106 if (notmuch_config_is_new (config))
\r
107 welcome_message_pre_setup ();
\r