mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
cli: add --no-exclude option to count and search.
This option turns off the exclusion so all matching messages are returned. We do not need to add this to notmuch-show as that does not (yet) exclude.
This commit is contained in:
parent
4fa77d0318
commit
d845662970
2 changed files with 22 additions and 12 deletions
|
@ -35,8 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
|
||||||
char *query_str;
|
char *query_str;
|
||||||
int opt_index;
|
int opt_index;
|
||||||
int output = OUTPUT_MESSAGES;
|
int output = OUTPUT_MESSAGES;
|
||||||
const char **search_exclude_tags;
|
notmuch_bool_t no_exclude = FALSE;
|
||||||
size_t search_exclude_tags_length;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
notmuch_opt_desc_t options[] = {
|
notmuch_opt_desc_t options[] = {
|
||||||
|
@ -44,6 +43,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
|
||||||
(notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
|
(notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
|
||||||
{ "messages", OUTPUT_MESSAGES },
|
{ "messages", OUTPUT_MESSAGES },
|
||||||
{ 0, 0 } } },
|
{ 0, 0 } } },
|
||||||
|
{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
|
||||||
{ 0, 0, 0, 0, 0 }
|
{ 0, 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,10 +78,15 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
search_exclude_tags = notmuch_config_get_search_exclude_tags
|
if (!no_exclude) {
|
||||||
(config, &search_exclude_tags_length);
|
const char **search_exclude_tags;
|
||||||
for (i = 0; i < search_exclude_tags_length; i++)
|
size_t search_exclude_tags_length;
|
||||||
notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
|
|
||||||
|
search_exclude_tags = notmuch_config_get_search_exclude_tags
|
||||||
|
(config, &search_exclude_tags_length);
|
||||||
|
for (i = 0; i < search_exclude_tags_length; i++)
|
||||||
|
notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
|
||||||
|
}
|
||||||
|
|
||||||
switch (output) {
|
switch (output) {
|
||||||
case OUTPUT_MESSAGES:
|
case OUTPUT_MESSAGES:
|
||||||
|
|
|
@ -426,8 +426,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
|
||||||
output_t output = OUTPUT_SUMMARY;
|
output_t output = OUTPUT_SUMMARY;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int limit = -1; /* unlimited */
|
int limit = -1; /* unlimited */
|
||||||
const char **search_exclude_tags;
|
notmuch_bool_t no_exclude = FALSE;
|
||||||
size_t search_exclude_tags_length;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
|
enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
|
||||||
|
@ -449,6 +448,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
|
||||||
{ "files", OUTPUT_FILES },
|
{ "files", OUTPUT_FILES },
|
||||||
{ "tags", OUTPUT_TAGS },
|
{ "tags", OUTPUT_TAGS },
|
||||||
{ 0, 0 } } },
|
{ 0, 0 } } },
|
||||||
|
{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
|
||||||
{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
|
{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
|
||||||
{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
|
{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
|
||||||
{ 0, 0, 0, 0, 0 }
|
{ 0, 0, 0, 0, 0 }
|
||||||
|
@ -496,10 +496,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
|
||||||
|
|
||||||
notmuch_query_set_sort (query, sort);
|
notmuch_query_set_sort (query, sort);
|
||||||
|
|
||||||
search_exclude_tags = notmuch_config_get_search_exclude_tags
|
if (!no_exclude) {
|
||||||
(config, &search_exclude_tags_length);
|
const char **search_exclude_tags;
|
||||||
for (i = 0; i < search_exclude_tags_length; i++)
|
size_t search_exclude_tags_length;
|
||||||
notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
|
|
||||||
|
search_exclude_tags = notmuch_config_get_search_exclude_tags
|
||||||
|
(config, &search_exclude_tags_length);
|
||||||
|
for (i = 0; i < search_exclude_tags_length; i++)
|
||||||
|
notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
|
||||||
|
}
|
||||||
|
|
||||||
switch (output) {
|
switch (output) {
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue