Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id F01BB4196F0 for ; Thu, 8 Apr 2010 12:39:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.5 X-Spam-Level: X-Spam-Status: No, score=-0.5 tagged_above=-999 required=5 tests=[BAYES_05=-0.5] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pFZue1C2C9A0 for ; Thu, 8 Apr 2010 12:39:38 -0700 (PDT) Received: from everglades.pioto.org (everglades.pioto.org [207.192.69.249]) by olra.theworths.org (Postfix) with ESMTP id 3EC8F431FC1 for ; Thu, 8 Apr 2010 12:39:38 -0700 (PDT) Received: from aether.pioto.org (pool-96-236-149-110.pitbpa.fios.verizon.net [96.236.149.110]) (Authenticated sender: pioto) by everglades.pioto.org (Postfix) with ESMTPA id 8211916053F; Thu, 8 Apr 2010 15:39:37 -0400 (EDT) Received: by aether.pioto.org (Postfix, from userid 1000) id 9E1AE6B08C; Thu, 8 Apr 2010 15:40:41 -0400 (EDT) From: Mike Kelly To: notmuch@notmuchmail.org Subject: [PATCH] Have notmuch count default to showing the total. Date: Thu, 8 Apr 2010 15:39:38 -0400 Message-Id: <1270755578-23725-1-git-send-email-pioto@pioto.org> X-Mailer: git-send-email 1.7.0.4 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2010 19:39:39 -0000 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 | 5 ++--- notmuch.c | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/notmuch-count.c b/notmuch-count.c index 77aa433..97242ab 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 f5669fc..8650951 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, -- 1.7.0.4