]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-show.c
cli: notmuch show support for --body=false with --format=text
[notmuch] / notmuch-show.c
index c3a3783a4094c952f61b567907b87f658a1381ab..42fe27cc99fca564f237f550c60db01d17408794 100644 (file)
@@ -574,6 +574,11 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
        g_mime_stream_printf (stream, "Date: %s\n", date_string);
        g_mime_stream_printf (stream, "\fheader}\n");
 
+       if (!params->output_body)
+       {
+           g_mime_stream_printf (stream, "\f%s}\n", part_type);
+           return NOTMUCH_STATUS_SUCCESS;
+       }
        g_mime_stream_printf (stream, "\fbody{\n");
     }
 
@@ -1204,9 +1209,11 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
            fprintf (stderr, "Warning: --body=false is incompatible with --part > 0. Disabling.\n");
            params.output_body = true;
        } else {
-           if (format != NOTMUCH_FORMAT_JSON && format != NOTMUCH_FORMAT_SEXP)
+           if (format != NOTMUCH_FORMAT_TEXT &&
+               format != NOTMUCH_FORMAT_JSON &&
+               format != NOTMUCH_FORMAT_SEXP)
                fprintf (stderr,
-                        "Warning: --body=false only implemented for format=json and format=sexp\n");
+                        "Warning: --body=false only implemented for format=text, format=json and format=sexp\n");
        }
     }