aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-show.c
diff options
context:
space:
mode:
authorGravatar Jameson Graef Rollins <jrollins@finestructure.net>2011-05-23 15:38:49 -0700
committerGravatar Carl Worth <cworth@cworth.org>2011-05-24 12:04:08 -0700
commita01956924eb5b7fd4077b1c6678cbc53faa99d43 (patch)
treeab3cd3282e2f4e354cdd986daa903ac67ef1c0fd /notmuch-show.c
parentbdc260ae28301da1d022ead53555fb9369ce04e7 (diff)
use format=raw by default when requesting part with --part=
This makes part retrieval a little more intuitive, since generally one will always want to retrieve parts in raw form.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r--notmuch-show.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index c57f7bd0..d11a2b81 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -710,6 +710,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;
int mbox = 0;
+ int format_specified = 0;
int i;
params.entire_thread = 0;
@@ -738,6 +739,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
fprintf (stderr, "Invalid value for --format: %s\n", opt);
return 1;
}
+ format_specified = 1;
} else if (STRNCMP_LITERAL (argv[i], "--part=") == 0) {
params.part = atoi(argv[i] + sizeof ("--part=") - 1);
} else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {
@@ -782,6 +784,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
return 1;
}
+ /* if part was requested and format was not specified, use format=raw */
+ if (params.part >= 0 && !format_specified)
+ format = &format_raw;
+
/* If --format=raw specified without specifying part, we can only
* output single message, so set part=0 */
if (params.raw && params.part < 0)