From: David Bremner <david@tethera.net>
To: notmuch@freelists.org
Subject: [PATCH 1/3] cli/show: convert keyword options to booleans
Date: Wed, 11 Oct 2017 14:35:17 -0000 [thread overview]
Message-ID: <20170509021719.13086-2-david@tethera.net> (raw)
In-Reply-To: <20170509021719.13086-1-david@tethera.net>
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
next parent reply other threads:[~2017-10-11 14:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170509021719.13086-1-david@tethera.net>
2017-10-11 14:35 ` David Bremner [this message]
2017-07-01 15:18 v3 of spaces command line argument separator David Bremner
2017-07-01 15:18 ` [PATCH 1/3] cli/show: convert keyword options to booleans David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170509021719.13086-2-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@freelists.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).