mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 15:21:41 +01:00
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.
This commit is contained in:
parent
bdc260ae28
commit
a01956924e
1 changed files with 6 additions and 0 deletions
|
@ -710,6 +710,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
|
||||||
const notmuch_show_format_t *format = &format_text;
|
const notmuch_show_format_t *format = &format_text;
|
||||||
notmuch_show_params_t params;
|
notmuch_show_params_t params;
|
||||||
int mbox = 0;
|
int mbox = 0;
|
||||||
|
int format_specified = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
params.entire_thread = 0;
|
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);
|
fprintf (stderr, "Invalid value for --format: %s\n", opt);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
format_specified = 1;
|
||||||
} else if (STRNCMP_LITERAL (argv[i], "--part=") == 0) {
|
} else if (STRNCMP_LITERAL (argv[i], "--part=") == 0) {
|
||||||
params.part = atoi(argv[i] + sizeof ("--part=") - 1);
|
params.part = atoi(argv[i] + sizeof ("--part=") - 1);
|
||||||
} else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {
|
} 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;
|
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
|
/* If --format=raw specified without specifying part, we can only
|
||||||
* output single message, so set part=0 */
|
* output single message, so set part=0 */
|
||||||
if (params.raw && params.part < 0)
|
if (params.raw && params.part < 0)
|
||||||
|
|
Loading…
Reference in a new issue