There are two keyword options here that impliment boolean options. It is simpler to use the built-in boolean argument handling, and also more robust against divergence in parsing boolean and keyword arguments. --- notmuch-show.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 7021008e..2f1904db 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -1028,8 +1028,8 @@ enum { /* The following is to allow future options to be added more easily */ enum { - EXCLUDE_TRUE, - EXCLUDE_FALSE, + EXCLUDE_FALSE = FALSE, + EXCLUDE_TRUE = TRUE, }; int @@ -1060,15 +1060,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) { "raw", NOTMUCH_FORMAT_RAW }, { 0, 0 } } }, { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 }, - { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x', - (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE }, - { "false", EXCLUDE_FALSE }, - { 0, 0 } } }, - { NOTMUCH_OPT_KEYWORD, &entire_thread, "entire-thread", 't', - (notmuch_keyword_t []){ { "true", ENTIRE_THREAD_TRUE }, - { "false", ENTIRE_THREAD_FALSE }, - { "", ENTIRE_THREAD_TRUE }, - { 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 }, -- 2.11.0 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch