aboutsummaryrefslogtreecommitdiff
path: root/notmuch-show.c
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-12-19 11:40:54 -0500
committerDavid Bremner <david@tethera.net>2017-12-29 16:45:46 -0400
commit8ea4a99d74737929f58568505e41c94f65a14743 (patch)
tree883dcaa320dc97b3a9cba27d2f18f848965e57b8 /notmuch-show.c
parent0ada2a05c94de72bc2c7c57a790e92b77af37a42 (diff)
cli/show: make --decrypt take a keyword.
We also expand tab completion for it, update the emacs bindings, and update T350, T357, and T450 to match. Make use of the bool-to-keyword backward-compatibility feature.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r--notmuch-show.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index d5adc370..9871159d 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1085,8 +1085,6 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
bool exclude = true;
bool entire_thread_set = false;
bool single_message;
- bool decrypt = false;
- bool decrypt_set = false;
notmuch_opt_desc_t options[] = {
{ .opt_keyword = &format, .name = "format", .keywords =
@@ -1101,7 +1099,12 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
{ .opt_bool = &params.entire_thread, .name = "entire-thread",
.present = &entire_thread_set },
{ .opt_int = &params.part, .name = "part" },
- { .opt_bool = &decrypt, .name = "decrypt", .present = &decrypt_set },
+ { .opt_keyword = (int*)(&params.crypto.decrypt), .name = "decrypt",
+ .keyword_no_arg_value = "true", .keywords =
+ (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
+ { "auto", NOTMUCH_DECRYPT_AUTO },
+ { "true", NOTMUCH_DECRYPT_NOSTASH },
+ { 0, 0 } } },
{ .opt_bool = &params.crypto.verify, .name = "verify" },
{ .opt_bool = &params.output_body, .name = "body" },
{ .opt_bool = &params.include_html, .name = "include-html" },
@@ -1115,16 +1118,9 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_process_shared_options (argv[0]);
- if (decrypt_set) {
- if (decrypt) {
- /* we do not need or want to ask for session keys */
- params.crypto.decrypt = NOTMUCH_DECRYPT_NOSTASH;
- /* decryption implies verification */
- params.crypto.verify = true;
- } else {
- params.crypto.decrypt = NOTMUCH_DECRYPT_FALSE;
- }
- }
+ /* explicit decryption implies verification */
+ if (params.crypto.decrypt == NOTMUCH_DECRYPT_NOSTASH)
+ params.crypto.verify = true;
/* specifying a part implies single message display */
single_message = params.part >= 0;