mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 01:14:53 +01:00
CLI/show: warn if crypto options are used with mbox format
This limitation seems somewhat hard to fix, but at least try to warn users when combining crypto operations with mbox output format. Because the default is --decrypt=auto, the warning is omitted if --decrypt=auto is specified. While this is not great, it seems more wrong to always warn, or to change the default because of this.
This commit is contained in:
parent
bc98920917
commit
a691d54280
2 changed files with 27 additions and 0 deletions
|
@ -1399,6 +1399,14 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[])
|
||||||
fprintf (stderr, "Error: specifying parts is incompatible with mbox output format.\n");
|
fprintf (stderr, "Error: specifying parts is incompatible with mbox output format.\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
if (params.crypto.decrypt != NOTMUCH_DECRYPT_FALSE
|
||||||
|
&& params.crypto.decrypt != NOTMUCH_DECRYPT_AUTO) {
|
||||||
|
fprintf (stderr, "Warning: mbox format does not support decryption (ignored)\n");
|
||||||
|
}
|
||||||
|
if (params.crypto.verify) {
|
||||||
|
fprintf (stderr,
|
||||||
|
"Warning: mbox format does not support signature verification (ignored)\n");
|
||||||
|
}
|
||||||
} else if (format == NOTMUCH_FORMAT_RAW) {
|
} else if (format == NOTMUCH_FORMAT_RAW) {
|
||||||
/* raw format only supports single message display */
|
/* raw format only supports single message display */
|
||||||
single_message = true;
|
single_message = true;
|
||||||
|
|
|
@ -17,6 +17,25 @@ notmuch show foo..
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
test_expect_equal 1 $exit_code
|
test_expect_equal 1 $exit_code
|
||||||
|
|
||||||
|
test_begin_subtest "warning for --mbox --decrypt"
|
||||||
|
notmuch show --format=mbox --decrypt=true '*' 1>/dev/null 2>OUTPUT
|
||||||
|
echo $? >> OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
Warning: mbox format does not support decryption (ignored)
|
||||||
|
Warning: mbox format does not support signature verification (ignored)
|
||||||
|
0
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "warning for --mbox --verify"
|
||||||
|
notmuch show --format=mbox --verify '*' 1>/dev/null 2>OUTPUT
|
||||||
|
echo $? >> OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
Warning: mbox format does not support signature verification (ignored)
|
||||||
|
0
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "notmuch show --sort=newest-first"
|
test_begin_subtest "notmuch show --sort=newest-first"
|
||||||
notmuch show --entire-thread=true '*' > EXPECTED
|
notmuch show --entire-thread=true '*' > EXPECTED
|
||||||
notmuch show --entire-thread=true --sort=newest-first '*' > OUTPUT
|
notmuch show --entire-thread=true --sort=newest-first '*' > OUTPUT
|
||||||
|
|
Loading…
Reference in a new issue