[PATCH 3/3] cli: allow switching off entire thread mode in notmuch show json format
Jani Nikula
jani at nikula.org
Fri Mar 9 14:33:30 PST 2012
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 at 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, ¶ms.part, "part", 'p', 0 },
- { NOTMUCH_OPT_BOOLEAN, ¶ms.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, ¶ms.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
More information about the notmuch
mailing list