From: David Bremner <bremner@unb.ca> This makes it easier to define minimal formats without defining several dummy functions that do nothing. --- notmuch-show.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index b6e3f44..51aa87d 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -326,14 +326,17 @@ static void show_message (void *ctx, const show_format_t *format, notmuch_message_t *message, int indent) { fputs (format->message_start, stdout); - format->message(ctx, message, indent); + if (format->message) + format->message(ctx, message, indent); fputs (format->header_start, stdout); - format->header(ctx, message); + if (format->header) + format->header(ctx, message); fputs (format->header_end, stdout); fputs (format->body_start, stdout); - show_message_body (notmuch_message_get_filename (message), format->part); + if (format->part) + show_message_body (notmuch_message_get_filename (message), format->part); fputs (format->body_end, stdout); fputs (format->message_end, stdout); @@ -408,7 +411,9 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) } if (STRNCMP_LITERAL (argv[i], "--format=") == 0) { opt = argv[i] + sizeof ("--format=") - 1; - if (strcmp (opt, "text") == 0) { + if (strcmp (opt, "tabular") == 0) { + format = &format_tabular; + } else if (strcmp (opt, "text") == 0) { format = &format_text; } else if (strcmp (opt, "json") == 0) { format = &format_json; -- 1.6.5.3