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
This commit is contained in:
Mike Kelly 2010-04-08 15:39:38 -04:00 committed by Carl Worth
parent 37b8f5a8f2
commit b15a03fafc
2 changed files with 6 additions and 3 deletions

View file

@ -90,9 +90,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
fprintf (stderr, "Out of memory.\n"); fprintf (stderr, "Out of memory.\n");
return 1; return 1;
} }
if (*query_str == '\0') { if (*query_str == '\0' || (*query_str == '*' && *(query_str+1) == '\0')) {
fprintf (stderr, "Error: notmuch count requires at least one count term.\n"); query_str = talloc_strdup (ctx, "");
return 1;
} }
query = notmuch_query_create (notmuch, query_str); query = notmuch_query_create (notmuch, query_str);

View file

@ -220,6 +220,10 @@ command_t commands[] = {
"\tof messages matching both a specific tag and either inbox\n" "\tof messages matching both a specific tag and either inbox\n"
"\tor unread\n" "\tor unread\n"
"\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" "\tSee \"notmuch help search-terms\" for details of the search\n"
"\t\tterms syntax." }, "\t\tterms syntax." },
{ "reply", notmuch_reply_command, { "reply", notmuch_reply_command,