unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org, markwalters1009@gmail.com
Subject: [PATCH 3/3] cli: allow switching off entire thread mode in notmuch show json format
Date: Sat, 10 Mar 2012 00:33:30 +0200	[thread overview]
Message-ID: <7000ede2763163976d19072c9b73a253e01c6ca5.1331329406.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1331329406.git.jani@nikula.org>
In-Reply-To: <cover.1331329406.git.jani@nikula.org>

Previously --format=json implied --entire-thread with no way to switch
it off. Add support for --entire-thread=false usable with json format.

Signed-off-by: Jani Nikula <jani@nikula.org>
---
 notmuch-show.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 05d51b2..19e0119 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,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
 				  { "raw", NOTMUCH_FORMAT_RAW },
 				  { 0, 0 } } },
 	{ NOTMUCH_OPT_INT, &params.part, "part", 'p', 0 },
-	{ NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },
+	{ NOTMUCH_OPT_KEYWORD_DEFAULT, &entire_thread, "entire-thread", 't',
+	  (notmuch_keyword_t []){ { "true", TRUE },
+				  { "false", FALSE },
+				  { 0, 0 } } },
 	{ NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },
 	{ NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
 	{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },
@@ -1020,7 +1024,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)
+	    params.entire_thread = TRUE;
 	break;
     case NOTMUCH_FORMAT_TEXT:
 	format = &format_text;
@@ -1043,6 +1048,9 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
 	break;
     }
 
+    if (entire_thread != -1)
+	params.entire_thread = entire_thread;
+
     if (params.decrypt || verify) {
 #ifdef GMIME_ATLEAST_26
 	/* TODO: GMimePasswordRequestFunc */
-- 
1.7.5.4

  parent reply	other threads:[~2012-03-09 22:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 22:15 [PATCH 0/2] cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN Mark Walters
2012-03-08 22:15 ` [PATCH 1/2] " Mark Walters
2012-03-08 22:15 ` [PATCH 2/2] cli: make --entire-thread option notmuch-show.c INT_OR_BOOLEAN Mark Walters
2012-03-09  0:48 ` [PATCH 0/2] cli: Parsing. Add option NOTMUCH_OPT_INT_OR_BOOLEAN Jani Nikula
2012-03-09  5:11   ` Mark Walters
2012-03-09 22:33     ` [PATCH 0/3] argument parsing additions Jani Nikula
2012-03-09 22:33       ` [PATCH 1/3] command-line-arguments: allow true and false keywords for booleans Jani Nikula
2012-03-09 22:33       ` [PATCH 2/3] command-line-arguments: support keyword arguments with default value Jani Nikula
2012-03-09 22:33       ` Jani Nikula [this message]
2012-03-10 11:23       ` [PATCH 0/3] argument parsing additions Mark Walters
2012-03-11 19:26         ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7000ede2763163976d19072c9b73a253e01c6ca5.1331329406.git.jani@nikula.org \
    --to=jani@nikula.org \
    --cc=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).