aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Kelly <pioto@pioto.org>2010-04-08 15:39:38 -0400
committerGravatar Carl Worth <cworth@cworth.org>2010-04-09 16:28:49 -0700
commitb15a03fafc2e313264519f030e45ea203af508e2 (patch)
tree028007eace4a20cbea518e1a050d64c3f76e2a9c
parent37b8f5a8f2af32eabbb5ff1ba751bdfa2ee08082 (diff)
Have notmuch count default to showing the total.
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
-rw-r--r--notmuch-count.c5
-rw-r--r--notmuch.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/notmuch-count.c b/notmuch-count.c
index 77aa4338..97242aba 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -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);
diff --git a/notmuch.c b/notmuch.c
index f5669fcd..86509515 100644
--- 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,