]> git.notmuchmail.org Git - notmuch/commitdiff
cli: add --exclude=all option to notmuch-search.c
authorMark Walters <markwalters1009@gmail.com>
Sat, 11 May 2013 19:50:03 +0000 (20:50 +0100)
committerDavid Bremner <bremner@unb.ca>
Tue, 14 May 2013 00:32:14 +0000 (21:32 -0300)
Add a --exclude=all option to notmuch search.

notmuch-search.c

index e6586397593f285ed906dbd799b1c6dd7d7877d1..43232011ceef788651f71b04056a8d3ada6b87be 100644 (file)
@@ -287,6 +287,7 @@ enum {
     EXCLUDE_TRUE,
     EXCLUDE_FALSE,
     EXCLUDE_FLAG,
+    EXCLUDE_ALL
 };
 
 int
@@ -334,6 +335,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
           (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
                                   { "false", EXCLUDE_FALSE },
                                   { "flag", EXCLUDE_FLAG },
+                                  { "all", EXCLUDE_ALL },
                                   { 0, 0 } } },
        { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
        { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },
@@ -400,7 +402,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
        exclude = EXCLUDE_FALSE;
     }
 
-    if (exclude == EXCLUDE_TRUE || exclude == EXCLUDE_FLAG) {
+    if (exclude != EXCLUDE_FALSE) {
        const char **search_exclude_tags;
        size_t search_exclude_tags_length;
 
@@ -409,7 +411,9 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
        for (i = 0; i < search_exclude_tags_length; i++)
            notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
        if (exclude == EXCLUDE_FLAG)
-           notmuch_query_set_omit_excluded (query, FALSE);
+           notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FALSE);
+       if (exclude == EXCLUDE_ALL)
+           notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);
     }
 
     switch (output) {