X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-show.c;h=3d11a40c6a597e5f59166a9187c89d9c53e41c88;hp=74e77249d123816257388d3a993811f37fba682b;hb=9a0df8128c1a2f92d03035aebbd7a90eb93ec601;hpb=e142de643d3bb4354f70e1490a97b491d1116e95 diff --git a/notmuch-show.c b/notmuch-show.c index 74e77249..3d11a40c 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -603,7 +603,7 @@ format_omitted_part_meta_sprinter (sprinter_t *sp, GMimeObject *meta, GMimePart void format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, - notmuch_bool_t first, notmuch_bool_t output_body, + notmuch_bool_t output_body, notmuch_bool_t include_html) { /* Any changes to the JSON or S-Expression format should be @@ -619,7 +619,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, if (output_body) { sp->map_key (sp, "body"); sp->begin_list (sp); - format_part_sprinter (ctx, sp, mime_node_child (node, 0), first, TRUE, include_html); + format_part_sprinter (ctx, sp, mime_node_child (node, 0), TRUE, include_html); sp->end (sp); } sp->end (sp); @@ -721,7 +721,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node, } for (i = 0; i < node->nchildren; i++) - format_part_sprinter (ctx, sp, mime_node_child (node, i), i == 0, TRUE, include_html); + format_part_sprinter (ctx, sp, mime_node_child (node, i), TRUE, include_html); /* Close content structures */ for (i = 0; i < nclose; i++) @@ -735,7 +735,7 @@ format_part_sprinter_entry (const void *ctx, sprinter_t *sp, mime_node_t *node, unused (int indent), const notmuch_show_params_t *params) { - format_part_sprinter (ctx, sp, node, TRUE, params->output_body, params->include_html); + format_part_sprinter (ctx, sp, node, params->output_body, params->include_html); return NOTMUCH_STATUS_SUCCESS; } @@ -1085,31 +1085,29 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) .output_body = TRUE, }; int format = NOTMUCH_FORMAT_NOT_SPECIFIED; - int exclude = TRUE; - - /* This value corresponds to neither true nor false being passed - * on the command line */ - int entire_thread = -1; + notmuch_bool_t exclude = TRUE; + notmuch_bool_t entire_thread_set = FALSE; notmuch_bool_t single_message; notmuch_opt_desc_t options[] = { - { NOTMUCH_OPT_KEYWORD, &format, "format", 'f', + { .opt_keyword = &format, .name = "format", .keywords = (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON }, { "text", NOTMUCH_FORMAT_TEXT }, { "sexp", NOTMUCH_FORMAT_SEXP }, { "mbox", NOTMUCH_FORMAT_MBOX }, { "raw", NOTMUCH_FORMAT_RAW }, { 0, 0 } } }, - { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 }, - { NOTMUCH_OPT_BOOLEAN, &exclude, "exclude", 'x', 0 }, - { NOTMUCH_OPT_BOOLEAN, &entire_thread, "entire-thread", 't', 0 }, - { NOTMUCH_OPT_INT, ¶ms.part, "part", 'p', 0 }, - { NOTMUCH_OPT_BOOLEAN, ¶ms.crypto.decrypt, "decrypt", 'd', 0 }, - { NOTMUCH_OPT_BOOLEAN, ¶ms.crypto.verify, "verify", 'v', 0 }, - { NOTMUCH_OPT_BOOLEAN, ¶ms.output_body, "body", 'b', 0 }, - { NOTMUCH_OPT_BOOLEAN, ¶ms.include_html, "include-html", 0, 0 }, - { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 }, - { 0, 0, 0, 0, 0 } + { .opt_int = ¬much_format_version, .name = "format-version" }, + { .opt_bool = &exclude, .name = "exclude" }, + { .opt_bool = ¶ms.entire_thread, .name = "entire-thread", + .present = &entire_thread_set }, + { .opt_int = ¶ms.part, .name = "part" }, + { .opt_bool = ¶ms.crypto.decrypt, .name = "decrypt" }, + { .opt_bool = ¶ms.crypto.verify, .name = "verify" }, + { .opt_bool = ¶ms.output_body, .name = "body" }, + { .opt_bool = ¶ms.include_html, .name = "include-html" }, + { .opt_inherit = notmuch_shared_options }, + { } }; opt_index = parse_arguments (argc, argv, options, 1); @@ -1147,14 +1145,9 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) /* Default is entire-thread = FALSE except for format=json and * format=sexp. */ - if (entire_thread != FALSE && entire_thread != TRUE) { - if (format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP) - params.entire_thread = TRUE; - else - params.entire_thread = FALSE; - } else { - params.entire_thread = entire_thread; - } + if (! entire_thread_set && + (format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP)) + params.entire_thread = TRUE; if (!params.output_body) { if (params.part > 0) {