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