1 Return-Path: <markwalters1009@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 BD355431FBC
\r
6 for <notmuch@notmuchmail.org>; Sat, 26 May 2012 08:55:19 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id iTMNuBYELESP for <notmuch@notmuchmail.org>;
\r
18 Sat, 26 May 2012 08:55:18 -0700 (PDT)
\r
19 Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com
\r
20 [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 52FFD429E48
\r
23 for <notmuch@notmuchmail.org>; Sat, 26 May 2012 08:55:14 -0700 (PDT)
\r
24 Received: by wibhn14 with SMTP id hn14so419591wib.2
\r
25 for <notmuch@notmuchmail.org>; Sat, 26 May 2012 08:55:13 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=uW9UzMUuW4RvL6HwveBZfKownUyZ/BrTGlBS2m1565g=;
\r
29 b=qVR5/jTnaNnbA6NU8D/QdE81MZMWWQDsA3YKJCiKY+cok4xwRZVqHOjulq2kpUgQKx
\r
30 gNvZ6GXXP8/2Skrm+tBRR0XlAHsMXi8cjzmG2s0QGlH7V2DbXqDi+uP2Dgjfl5OfFcYv
\r
31 qMN24jPSw7PwOcxfqfqhFcbd6e1bn08oMCHibxGl54yY4ZwPog8jz0jlXa46mJ3r2X10
\r
32 cv1ip7hLG1gh1uXmHwIjYlfgBf5egZiwqms6C2ihrUezW6m5XGEAB2bgxBpqDqHziqXE
\r
33 88F3MdtvOQPqV8SgW2mPHDIX6iyDB52vB+NiQAzfFIribX8AkyJrv2RvC0nYJj2TGznV
\r
35 Received: by 10.216.202.160 with SMTP id d32mr1393338weo.147.1338047709926;
\r
36 Sat, 26 May 2012 08:55:09 -0700 (PDT)
\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
38 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
39 e20sm5907028wiv.7.2012.05.26.08.55.08 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sat, 26 May 2012 08:55:09 -0700 (PDT)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH v5 3/5] cli: make --entire-thread=false work for format=json.
\r
44 Date: Sat, 26 May 2012 16:54:52 +0100
\r
45 Message-Id: <1338047694-32548-4-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.9.1
\r
47 In-Reply-To: <1338047694-32548-1-git-send-email-markwalters1009@gmail.com>
\r
48 References: <1338047694-32548-1-git-send-email-markwalters1009@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Sat, 26 May 2012 15:55:20 -0000
\r
63 The --entire-thread option in notmuch-show.c defaults to true when
\r
64 format=json. Previously there was no way to turn this off. This patch
\r
65 makes it respect --entire-thread=false.
\r
67 To do this the patch moves the --entire-thread option to be a keyword
\r
68 option using the new command line parsing to allow the existing
\r
69 --entire-thread syntax to keep working.
\r
71 notmuch-show.c | 25 +++++++++++++++++++++++--
\r
72 1 files changed, 23 insertions(+), 2 deletions(-)
\r
74 diff --git a/notmuch-show.c b/notmuch-show.c
\r
75 index 97da5cc..207093a 100644
\r
76 --- a/notmuch-show.c
\r
77 +++ b/notmuch-show.c
\r
78 @@ -981,6 +981,12 @@ enum {
\r
83 + ENTIRE_THREAD_DEFAULT,
\r
84 + ENTIRE_THREAD_TRUE,
\r
85 + ENTIRE_THREAD_FALSE,
\r
88 /* The following is to allow future options to be added more easily */
\r
91 @@ -1000,6 +1006,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
92 int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
\r
93 notmuch_bool_t verify = FALSE;
\r
94 int exclude = EXCLUDE_TRUE;
\r
95 + int entire_thread = ENTIRE_THREAD_DEFAULT;
\r
97 notmuch_opt_desc_t options[] = {
\r
98 { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
\r
99 @@ -1012,8 +1019,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
100 (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
\r
101 { "false", EXCLUDE_FALSE },
\r
103 + { NOTMUCH_OPT_KEYWORD, &entire_thread, "entire-thread", 't',
\r
104 + (notmuch_keyword_t []){ { "true", ENTIRE_THREAD_TRUE },
\r
105 + { "false", ENTIRE_THREAD_FALSE },
\r
107 { NOTMUCH_OPT_INT, ¶ms.part, "part", 'p', 0 },
\r
108 - { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 },
\r
109 { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },
\r
110 { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
\r
112 @@ -1036,7 +1046,9 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
113 switch (format_sel) {
\r
114 case NOTMUCH_FORMAT_JSON:
\r
115 format = &format_json;
\r
116 - params.entire_thread = TRUE;
\r
117 + /* JSON defaults to entire-thread TRUE */
\r
118 + if (entire_thread == ENTIRE_THREAD_DEFAULT)
\r
119 + entire_thread = ENTIRE_THREAD_TRUE;
\r
121 case NOTMUCH_FORMAT_TEXT:
\r
122 format = &format_text;
\r
123 @@ -1058,6 +1070,15 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
127 + /* Default is entire-thread = FALSE except for format=json which
\r
128 + * is dealt with above. */
\r
129 + if (entire_thread == ENTIRE_THREAD_DEFAULT)
\r
130 + entire_thread = ENTIRE_THREAD_FALSE;
\r
132 + if (entire_thread == ENTIRE_THREAD_TRUE)
\r
133 + params.entire_thread = TRUE;
\r
135 + params.entire_thread = FALSE;
\r
137 if (params.decrypt || verify) {
\r
138 #ifdef GMIME_ATLEAST_26
\r