summaryrefslogtreecommitdiffstats
path: root/notmuch-count.c
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2017-10-14 23:18:36 +0300
committerDavid Bremner <david@tethera.net>2017-10-15 19:22:40 -0300
commitab8b40f7e350c0661dda5b9d52041150ed339a39 (patch)
treebafe09ec8bc42c1a4029d7fc8fa14aa782f54d0b /notmuch-count.c
parentbcd6229d26c26e694b185fb8bf762bad606916c8 (diff)
cli: make notmuch count --exclude a boolean argument
Commit 0f314c0c99be ("cli: convert notmuch_bool_t to stdbool") over-eagerly converted EXCLUDE_TRUE and EXCLUDE_FALSE to EXCLUDE_true and EXCLUDE_false in notmuch-count.c. We could just fix the case back, but convert the option to an actual boolean argument instead. We've used a keyword argument rather than a boolean argument for notmuch count --exclude for five years, since commit 785c1e497f05 ("cli: move count to the new --exclude=(true|false|flag) naming scheme."), "to allow future options to be added more easily". I think we can conclude future options aren't coming any time soon.
Diffstat (limited to 'notmuch-count.c')
-rw-r--r--notmuch-count.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/notmuch-count.c b/notmuch-count.c
index 1ae7d514..ca05c979 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -27,12 +27,6 @@ enum {
OUTPUT_FILES,
};
-/* The following is to allow future options to be added more easily */
-enum {
- EXCLUDE_true,
- EXCLUDE_false,
-};
-
/* Return the number of files matching the query, or -1 for an error */
static int
count_files (notmuch_query_t *query)
@@ -160,7 +154,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
char *query_str;
int opt_index;
int output = OUTPUT_MESSAGES;
- int exclude = EXCLUDE_true;
+ bool exclude = true;
const char **search_exclude_tags = NULL;
size_t search_exclude_tags_length = 0;
bool batch = false;
@@ -175,10 +169,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
{ "messages", OUTPUT_MESSAGES },
{ "files", OUTPUT_FILES },
{ 0, 0 } } },
- { .opt_keyword = &exclude, .name = "exclude", .keywords =
- (notmuch_keyword_t []){ { "true", EXCLUDE_true },
- { "false", EXCLUDE_false },
- { 0, 0 } } },
+ { .opt_bool = &exclude, .name = "exclude" },
{ .opt_bool = &print_lastmod, .name = "lastmod" },
{ .opt_bool = &batch, .name = "batch" },
{ .opt_string = &input_file_name, .name = "input" },
@@ -221,7 +212,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
return EXIT_FAILURE;
}
- if (exclude == EXCLUDE_true) {
+ if (exclude) {
search_exclude_tags = notmuch_config_get_search_exclude_tags
(config, &search_exclude_tags_length);
}