]> git.notmuchmail.org Git - notmuch/commitdiff
Have notmuch count default to showing the total.
authorMike Kelly <pioto@pioto.org>
Thu, 8 Apr 2010 19:39:38 +0000 (15:39 -0400)
committerCarl Worth <cworth@cworth.org>
Fri, 9 Apr 2010 23:28:49 +0000 (16:28 -0700)
If no parameters are given to notmuch-count, or just '' or '*' are
given, return the total number of messages in the database.

update notmuch count help

notmuch-count.c
notmuch.c

index 77aa4338db27e2b3cdfceaff43e2233d3788bdd7..97242abaa778b00764264a0c396e65f6be75e188 100644 (file)
@@ -90,9 +90,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
        fprintf (stderr, "Out of memory.\n");
        return 1;
     }
-    if (*query_str == '\0') {
-       fprintf (stderr, "Error: notmuch count requires at least one count term.\n");
-       return 1;
+    if (*query_str == '\0' || (*query_str == '*' && *(query_str+1) == '\0')) {
+       query_str = talloc_strdup (ctx, "");
     }
 
     query = notmuch_query_create (notmuch, query_str);
index f5669fcda2093cf5116f7bb99e7c5674745eb9d3..8650951533e22cd2aa31807111f3ecffba0c4eb6 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -220,6 +220,10 @@ command_t commands[] = {
       "\tof messages matching both a specific tag and either inbox\n"
       "\tor unread\n"
       "\n"
+      "\tIf no parameters are given, or the special search terms '' or\n"
+      "\t'*' are given, it will display the total number of messages in\n"
+      "\tthe database.\n"
+      "\n"
       "\tSee \"notmuch help search-terms\" for details of the search\n"
       "\t\tterms syntax." },
     { "reply", notmuch_reply_command,