[PATCH 6/6] cli: add compact --verbose option and silence output without it
authorJani Nikula <jani@nikula.org>
Fri, 1 Nov 2013 14:27:15 +0000 (15:27 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:50 +0000 (09:57 -0800)
8a/0e72077c57794c80e6dbe97c4f2b95e3e6c687 [new file with mode: 0644]

diff --git a/8a/0e72077c57794c80e6dbe97c4f2b95e3e6c687 b/8a/0e72077c57794c80e6dbe97c4f2b95e3e6c687
new file mode 100644 (file)
index 0000000..2d46c40
--- /dev/null
@@ -0,0 +1,122 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8955E431FD6\r
+       for <notmuch@notmuchmail.org>; Fri,  1 Nov 2013 07:28:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id c9C3AWAb9bPK for <notmuch@notmuchmail.org>;\r
+       Fri,  1 Nov 2013 07:27:56 -0700 (PDT)\r
+Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com\r
+       [209.85.212.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 14241431FC9\r
+       for <notmuch@notmuchmail.org>; Fri,  1 Nov 2013 07:27:47 -0700 (PDT)\r
+Received: by mail-wi0-f176.google.com with SMTP id ex4so1152921wid.15\r
+       for <notmuch@notmuchmail.org>; Fri, 01 Nov 2013 07:27:47 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references:in-reply-to:references;\r
+       bh=vNJlk+TqGnF2CtjKBlGwl8qgV/+yCpn9o1orrMiYDNI=;\r
+       b=mPG2koh8rbjn4O8vtQIO2/vvR1+TaxzQfi6V7cxUrXdr4FC/o4mDGHTJqn5TC/z8DZ\r
+       rR2hXVMYSAZLfSRLe3pngnpBpSTituIjyGcJTBS2BTvigp4OgbO/LAqeFgmfarpKjwj4\r
+       4YHIetMLSscEzYdmVzQA2ks98jIx6AVJFrs76RDRRnJHEy0eZSBjc+jpbflYPk9BN2ni\r
+       UTU8pMEE87R3Rdrht9Hp2u+oMHs99a8u79baZXW/1rN9OX34rOlmq7VCHlTGEaRcB6F8\r
+       WLX/uXxNo1I2zeTlN8wbX44zLWz87En0aAKoN9LTkKLkQIu+PlbdX2HTkPu3R0NMUOYY\r
+       8DYQ==\r
+X-Gm-Message-State:\r
+ ALoCoQmwxXZq7iSrD4dzXEAdvlMm9oPX6ZntCoOeqizkudq5LINq9ojfdD80OrP4hTjS6fXhBhZr\r
+X-Received: by 10.181.11.163 with SMTP id ej3mr2460386wid.47.1383316066997;\r
+       Fri, 01 Nov 2013 07:27:46 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+       by mx.google.com with ESMTPSA id ll10sm6996165wic.9.2013.11.01.07.27.45\r
+       for <multiple recipients>\r
+       (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+       Fri, 01 Nov 2013 07:27:46 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 6/6] cli: add compact --verbose option and silence output\r
+       without it\r
+Date: Fri,  1 Nov 2013 15:27:15 +0100\r
+Message-Id:\r
+ <f2bc7daf667f8d095eeac22f54e45870dfeeb959.1383315568.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.2.5\r
+In-Reply-To: <cover.1383315568.git.jani@nikula.org>\r
+References: <cover.1383315568.git.jani@nikula.org>\r
+In-Reply-To: <cover.1383315568.git.jani@nikula.org>\r
+References: <cover.1383315568.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 01 Nov 2013 14:28:02 -0000\r
+\r
+If there's nothing surprising to say, don't say anything. Unless asked\r
+for by the user.\r
+---\r
+ notmuch-compact.c |   16 +++++++++++-----\r
+ 1 files changed, 11 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/notmuch-compact.c b/notmuch-compact.c\r
+index ecac86a..c0ae22e 100644\r
+--- a/notmuch-compact.c\r
++++ b/notmuch-compact.c\r
+@@ -32,27 +32,33 @@ notmuch_compact_command (notmuch_config_t *config, int argc, char *argv[])\r
+     const char *path = notmuch_config_get_database_path (config);\r
+     const char *backup_path = NULL;\r
+     notmuch_status_t ret;\r
++    notmuch_bool_t verbose;\r
+     int opt_index;\r
\r
+     notmuch_opt_desc_t options[] = {\r
+       { NOTMUCH_OPT_STRING, &backup_path, "backup", 0, 0 },\r
++      { NOTMUCH_OPT_BOOLEAN,  &verbose, "verbose", 'v', 0 },\r
+     };\r
\r
+     opt_index = parse_arguments (argc, argv, options, 1);\r
+     if (opt_index < 0)\r
+       return 1;\r
\r
+-    printf ("Compacting database...\n");\r
+-    ret = notmuch_database_compact (path, backup_path, status_update_cb, NULL);\r
++    if (verbose)\r
++      printf ("Compacting database...\n");\r
++    ret = notmuch_database_compact (path, backup_path,\r
++                                  verbose ? status_update_cb : NULL, NULL);\r
+     if (ret) {\r
+       fprintf (stderr, "Compaction failed: %s\n", notmuch_status_to_string(ret));\r
+       return 1;\r
+     }\r
\r
+-    printf ("Done.\n");\r
++    if (verbose) {\r
++      printf ("Done.\n");\r
\r
+-    if (backup_path)\r
+-      printf ("The old database has been moved to %s.\n", backup_path);\r
++      if (backup_path)\r
++          printf ("The old database has been moved to %s.\n", backup_path);\r
++    }\r
\r
+     return 0;\r
+ }\r
+-- \r
+1.7.2.5\r
+\r