[PATCH 2/2] cli: make --entire-thread option notmuch-show.c INT_OR_BOOLEAN
authorMark Walters <markwalters1009@gmail.com>
Thu, 8 Mar 2012 22:15:44 +0000 (22:15 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:20 +0000 (09:45 -0800)
72/0cea02439238149b33404f9530a1a3404a5ebb [new file with mode: 0644]

diff --git a/72/0cea02439238149b33404f9530a1a3404a5ebb b/72/0cea02439238149b33404f9530a1a3404a5ebb
new file mode 100644 (file)
index 0000000..27c2a65
--- /dev/null
@@ -0,0 +1,116 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 552F9429E30\r
+       for <notmuch@notmuchmail.org>; Thu,  8 Mar 2012 14:16:19 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id vx2K6KgDUkQL for <notmuch@notmuchmail.org>;\r
+       Thu,  8 Mar 2012 14:16:18 -0800 (PST)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8DC22429E27\r
+       for <notmuch@notmuchmail.org>; Thu,  8 Mar 2012 14:16:16 -0800 (PST)\r
+Received: by werm13 with SMTP id m13so793870wer.26\r
+       for <notmuch@notmuchmail.org>; Thu, 08 Mar 2012 14:16:15 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=bP2rRCZwXRLS8yBbOvNWmbOKQpJVnEY/ccKTPWySWOk=;\r
+       b=o+EdwDawQHAuuexEaZYv7pnNqUY/TiddgOdbS3SIr7JlsNd9ue0moKoVeijeW5qyni\r
+       Ii/VS5L+kS4ZYLuJcNvYTDioEtuhokKgQiGGtyWEWcApkCVm+T6d5aFeNBq96aEzYmIC\r
+       aegbhgYlDZERlW/xarGCf7sLcJpYDPAKxWIZk51GDbsW2r4434EDuL2+Jwc4UowSvcaY\r
+       eCFdGHCu6RWlp14bha9+CvBi5eGA3Yc8zXGyQ6OYR9ZR9nvCEByPksLnHYLxvjka1lyk\r
+       LAuA3bIVpJL8u6Z8HVYsmkbwhCodoD5iHRDSyQY14BdWkCgX2PpBZRa0+1kIQ2cqGUhB\r
+       x6QQ==\r
+Received: by 10.216.138.38 with SMTP id z38mr4176822wei.63.1331244975317;\r
+       Thu, 08 Mar 2012 14:16:15 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ fw5sm47328264wib.0.2012.03.08.14.16.13        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 08 Mar 2012 14:16:14 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] cli: make --entire-thread option notmuch-show.c\r
+       INT_OR_BOOLEAN\r
+Date: Thu,  8 Mar 2012 22:15:44 +0000\r
+Message-Id: <1331244944-7960-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1331244944-7960-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1331244944-7960-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 08 Mar 2012 22:16:19 -0000\r
+\r
+Make the --entire-thread option notmuch-show.c\r
+NOTMUCH_OPT_INT_OR_BOOLEAN. In particular this means a caller can turn\r
+off entire-thread (by specifying --entire-thread=0) when format=json.\r
+(This was not previously possible.)\r
+---\r
+ notmuch-show.c |   10 ++++++++--\r
+ 1 files changed, 8 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 05d51b2..f0c640f 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -985,6 +985,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+     const notmuch_show_format_t *format = &format_text;\r
+     notmuch_show_params_t params = { .part = -1 };\r
+     int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;\r
++    int entire_thread = -1;\r
+     notmuch_bool_t verify = FALSE;\r
+     notmuch_bool_t no_exclude = FALSE;\r
\r
+@@ -996,7 +997,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+                                 { "raw", NOTMUCH_FORMAT_RAW },\r
+                                 { 0, 0 } } },\r
+       { NOTMUCH_OPT_INT, &params.part, "part", 'p', 0 },\r
+-      { NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },\r
++      { NOTMUCH_OPT_INT_OR_BOOLEAN, &entire_thread, "entire-thread", 't', 0 },\r
+       { NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },\r
+       { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },\r
+       { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },\r
+@@ -1020,7 +1021,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+     switch (format_sel) {\r
+     case NOTMUCH_FORMAT_JSON:\r
+       format = &format_json;\r
+-      params.entire_thread = TRUE;\r
++      if (entire_thread == -1)\r
++          entire_thread = 1;\r
+       break;\r
+     case NOTMUCH_FORMAT_TEXT:\r
+       format = &format_text;\r
+@@ -1042,6 +1044,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+       params.raw = TRUE;\r
+       break;\r
+     }\r
++    /* Set default to not entire_thread; JSON case dealt with above */\r
++    if (entire_thread == -1)\r
++      entire_thread = 0;\r
++    params.entire_thread = notmuch_int_to_boolean (entire_thread);\r
\r
+     if (params.decrypt || verify) {\r
+ #ifdef GMIME_ATLEAST_26\r
+-- \r
+1.7.9.1\r
+\r