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 E2E95431FCB
\r
6 for <notmuch@notmuchmail.org>; Sun, 3 Jun 2012 04:46:27 -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 Fot8Hm9CiQ05 for <notmuch@notmuchmail.org>;
\r
18 Sun, 3 Jun 2012 04:46:26 -0700 (PDT)
\r
19 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com
\r
20 [209.85.212.173]) (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 8F8F1431FBD
\r
23 for <notmuch@notmuchmail.org>; Sun, 3 Jun 2012 04:46:24 -0700 (PDT)
\r
24 Received: by wibhj6 with SMTP id hj6so1550539wib.2
\r
25 for <notmuch@notmuchmail.org>; Sun, 03 Jun 2012 04:46:23 -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=/n45GEHGLcfsqfBVT4i6/j+rh6VaZHY5XiDtZeEDCWo=;
\r
29 b=wJ/+tqllySOsbhgcygxLrYXmBNdggIT2fevPBbUN/Hg1zW9Z4HMjTtVz0QjWtorNwM
\r
30 L3URfoET4WKg98Vl2LOMm86GyCaaMWSer3zyLPeuxfMn0AyhEBsYWgs83gxGSYhjuIde
\r
31 MhNT0ZuQMwNjOmmTMR8Cf+xeVilms1AH3CILchjnQAG1wZyxZHDM0YqXdhGobSaObEtD
\r
32 wda0UuyLKFyhKPfem2rVrvbjPmjs840IUvLAWl6o96sfT9Mc0lSNqD8m0yaZyZDQNx7J
\r
33 SBcEdep7fbkasVISdC4rXh8DWplKpRIij6MviCbVAkjBX8CJg1bYsJWESn20Ad8hlwJ6
\r
35 Received: by 10.216.218.219 with SMTP id k69mr7293705wep.123.1338723983330;
\r
36 Sun, 03 Jun 2012 04:46:23 -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 ez4sm12140019wid.3.2012.06.03.04.46.21 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sun, 03 Jun 2012 04:46:22 -0700 (PDT)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [Patch v7 3/6] cli: make --entire-thread=false work for format=json.
\r
44 Date: Sun, 3 Jun 2012 12:46:09 +0100
\r
45 Message-Id: <1338723972-13063-4-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.9.1
\r
47 In-Reply-To: <1338723972-13063-1-git-send-email-markwalters1009@gmail.com>
\r
48 References: <1338723972-13063-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: Sun, 03 Jun 2012 11:46:28 -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 to keep working.
\r
71 notmuch-show.c | 27 +++++++++++++++++++++++++--
\r
72 1 files changed, 25 insertions(+), 2 deletions(-)
\r
74 diff --git a/notmuch-show.c b/notmuch-show.c
\r
75 index 97da5cc..61e19b0 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,12 @@ 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
106 + { "", ENTIRE_THREAD_TRUE },
\r
108 { NOTMUCH_OPT_INT, ¶ms.part, "part", 'p', 0 },
\r
109 - { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 },
\r
110 { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },
\r
111 { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
\r
113 @@ -1036,7 +1047,6 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
114 switch (format_sel) {
\r
115 case NOTMUCH_FORMAT_JSON:
\r
116 format = &format_json;
\r
117 - params.entire_thread = TRUE;
\r
119 case NOTMUCH_FORMAT_TEXT:
\r
120 format = &format_text;
\r
121 @@ -1059,6 +1069,19 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
125 + /* Default is entire-thread = FALSE except for format=json. */
\r
126 + if (entire_thread == ENTIRE_THREAD_DEFAULT) {
\r
127 + if (format == &format_json)
\r
128 + entire_thread = ENTIRE_THREAD_TRUE;
\r
130 + entire_thread = ENTIRE_THREAD_FALSE;
\r
133 + if (entire_thread == ENTIRE_THREAD_TRUE)
\r
134 + params.entire_thread = TRUE;
\r
136 + params.entire_thread = FALSE;
\r
138 if (params.decrypt || verify) {
\r
139 #ifdef GMIME_ATLEAST_26
\r
140 /* TODO: GMimePasswordRequestFunc */
\r