]> git.cworth.org Git - notmuch/blobdiff - notmuch-count.c
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / notmuch-count.c
index 048b1f44f7e3fca2f54d26f5908f00b20785be1d..0d9046a8a20835f910ed4ac0dc8447f0e67df069 100644 (file)
@@ -74,10 +74,12 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
     int ret = 0;
     notmuch_status_t status;
 
-    query = notmuch_query_create (notmuch, query_str);
-    if (query == NULL) {
-       fprintf (stderr, "Out of memory\n");
-       return -1;
+    status = notmuch_query_create_with_syntax (notmuch, query_str,
+                                              shared_option_query_syntax (),
+                                              &query);
+    if (print_status_database ("notmuch count", notmuch, status)) {
+       ret = -1;
+       goto DONE;
     }
 
     for (notmuch_config_values_start (exclude_tags);
@@ -86,12 +88,12 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
 
        status = notmuch_query_add_tag_exclude (query,
                                                notmuch_config_values_get (exclude_tags));
-           if (status && status != NOTMUCH_STATUS_IGNORED) {
-               print_status_query ("notmuch count", query, status);
-               ret = -1;
-               goto DONE;
-           }
+       if (status && status != NOTMUCH_STATUS_IGNORED) {
+           print_status_query ("notmuch count", query, status);
+           ret = -1;
+           goto DONE;
        }
+    }
 
     switch (output) {
     case OUTPUT_MESSAGES:
@@ -151,7 +153,7 @@ count_file (notmuch_database_t *notmuch, FILE *input, notmuch_config_values_t *e
 }
 
 int
-notmuch_count_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_count_command (notmuch_database_t *notmuch, int argc, char *argv[])
 {
     char *query_str;
     int opt_index;
@@ -182,7 +184,7 @@ notmuch_count_command (unused(notmuch_config_t *config), notmuch_database_t *not
     if (opt_index < 0)
        return EXIT_FAILURE;
 
-    notmuch_process_shared_options (argv[0]);
+    notmuch_process_shared_options (notmuch, argv[0]);
 
     if (input_file_name) {
        batch = true;
@@ -201,8 +203,6 @@ notmuch_count_command (unused(notmuch_config_t *config), notmuch_database_t *not
        return EXIT_FAILURE;
     }
 
-    notmuch_exit_if_unmatched_db_uuid (notmuch);
-
     query_str = query_string_from_args (notmuch, argc - opt_index, argv + opt_index);
     if (query_str == NULL) {
        fprintf (stderr, "Out of memory.\n");