The new keyword parsing makes this a trivial addition. It replaces
the previously proposed "--headers-only" functionality.
---
 notmuch-client.h |    4 +++-
 notmuch-show.c   |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index c241a7d..8e2d9da 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -78,12 +78,14 @@ typedef enum {
     NOTMUCH_SHOW_OUTPUT_HDR_REPLY_TO = 0x20,
     NOTMUCH_SHOW_OUTPUT_HDR_IN_REPLY_TO = 0x40,
     NOTMUCH_SHOW_OUTPUT_HDR_REFERENCES = 0x80,
+    NOTMUCH_SHOW_OUTPUT_BODY = 0x100,
     NOTMUCH_SHOW_OUTPUT_DEFAULT =
            NOTMUCH_SHOW_OUTPUT_HDR_SUBJECT |
            NOTMUCH_SHOW_OUTPUT_HDR_FROM |
            NOTMUCH_SHOW_OUTPUT_HDR_TO |
            NOTMUCH_SHOW_OUTPUT_HDR_CC |
-           NOTMUCH_SHOW_OUTPUT_HDR_DATE
+           NOTMUCH_SHOW_OUTPUT_HDR_DATE |
+           NOTMUCH_SHOW_OUTPUT_BODY
 } notmuch_show_output_t;

 typedef struct notmuch_show_format {
diff --git a/notmuch-show.c b/notmuch-show.c
index 242e8e0..5c3d5c3 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -586,7 +586,8 @@ format_part_json (const void *ctx, mime_node_t *node, 
notmuch_bool_t first, notm
        format_headers_json (ctx, GMIME_MESSAGE (node->part), output);

        printf (", \"body\": [");
-       format_part_json (ctx, mime_node_child (node, 0), first, output);
+       if (output & NOTMUCH_SHOW_OUTPUT_BODY)
+           format_part_json (ctx, mime_node_child (node, 0), first, output);

        printf ("]}");
        return;
@@ -1044,6 +1045,7 @@ notmuch_show_command (void *ctx, unused (int argc), 
unused (char *argv[]))
                                  { "reply-to", 
NOTMUCH_SHOW_OUTPUT_HDR_REPLY_TO },
                                  { "in-reply-to", 
NOTMUCH_SHOW_OUTPUT_HDR_IN_REPLY_TO },
                                  { "references", 
NOTMUCH_SHOW_OUTPUT_HDR_REFERENCES },
+                                 { "body", NOTMUCH_SHOW_OUTPUT_BODY },
                                  { 0, 0 } } },
        { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',
          (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
-- 
1.7.9.1

Reply via email to