[PATCH 1/2] cli: add compact --quiet option and silence output with it
authorJani Nikula <jani@nikula.org>
Wed, 6 Nov 2013 16:38:55 +0000 (18:38 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:01 +0000 (09:58 -0800)
92/d61781f5e0f50b75dd78b14c368761ee0e1865 [new file with mode: 0644]

diff --git a/92/d61781f5e0f50b75dd78b14c368761ee0e1865 b/92/d61781f5e0f50b75dd78b14c368761ee0e1865
new file mode 100644 (file)
index 0000000..9fd4efe
--- /dev/null
@@ -0,0 +1,124 @@
+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 00AA7429E53\r
+       for <notmuch@notmuchmail.org>; Wed,  6 Nov 2013 08:45:01 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 1yeocI8zqEEI for <notmuch@notmuchmail.org>;\r
+       Wed,  6 Nov 2013 08:44:54 -0800 (PST)\r
+Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com\r
+       [209.85.215.177]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3E32E429E27\r
+       for <notmuch@notmuchmail.org>; Wed,  6 Nov 2013 08:44:54 -0800 (PST)\r
+Received: by mail-ea0-f177.google.com with SMTP id f15so4999816eak.8\r
+       for <notmuch@notmuchmail.org>; Wed, 06 Nov 2013 08:44:53 -0800 (PST)\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;\r
+       bh=WV0SNbxxOZ+3pzHFokUvMfxMM2crA/+5gZY0bc1w7os=;\r
+       b=mv7IW1bCrjaYsa5eeDop5U6xJ+0KS6ElGE9ugc4gpjR3DyIMnKMLteH0L4wjtltWoA\r
+       msFN40ZMdcMzxx/bSjjgS6iU3FSz3I67DM0Ad7xvk4OpotVO1Iy9Uk/wMCXoW525d8uk\r
+       GVWmw6w2Bke3G0mOFLm28cv+YnL3Lua7SG+M0LS8tZR8org2oPnhfohI/4vvIt3HjFvq\r
+       utgEGUIQeVoUMFLaQL8YjAev8fbGalxZUYheYBtC5iCmgIq2Qkc2DGS/4ZqUIrvr+hB0\r
+       PPKZN5RyLMPQRXR6LH+TZTjlwYmTtWXNDvVTgnosbqsYggNcGYtzMEx8Q+197moIxCl+\r
+       w7Rw==\r
+X-Gm-Message-State:\r
+ ALoCoQmrMB47V7pjph6fUFRnKvJKhB/nj+ZzNbETjJ4KEDIr5ONVbVZP8uyaW6pzddV3SdP4ErlZ\r
+X-Received: by 10.14.107.133 with SMTP id o5mr96981eeg.110.1383755939094;\r
+       Wed, 06 Nov 2013 08:38:59 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91])\r
+       by mx.google.com with ESMTPSA id k7sm75805766eeg.13.2013.11.06.08.38.56\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Wed, 06 Nov 2013 08:38:57 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] cli: add compact --quiet option and silence output with\r
+ it\r
+Date: Wed,  6 Nov 2013 18:38:55 +0200\r
+Message-Id: <1383755936-11862-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To:\r
+ <3d33996df44b338847dac930b6cd294c57b6e54b.1383481295.git.jani@nikula.org>\r
+References:\r
+ <3d33996df44b338847dac930b6cd294c57b6e54b.1383481295.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: Wed, 06 Nov 2013 16:45:02 -0000\r
+\r
+Provide a way to silence the output.\r
+\r
+---\r
+\r
+v2: --verbose -> --quiet\r
+---\r
+ notmuch-compact.c | 16 +++++++++++-----\r
+ 1 file changed, 11 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/notmuch-compact.c b/notmuch-compact.c\r
+index 359acfc..8022dfe 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 quiet;\r
+     int opt_index;\r
\r
+     notmuch_opt_desc_t options[] = {\r
+       { NOTMUCH_OPT_STRING, &backup_path, "backup", 0, 0 },\r
++      { NOTMUCH_OPT_BOOLEAN,  &quiet, "quiet", 'q', 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 (! quiet)\r
++      printf ("Compacting database...\n");\r
++    ret = notmuch_database_compact (path, backup_path,\r
++                                  quiet ? NULL : status_update_cb, NULL);\r
+     if (ret) {\r
+       fprintf (stderr, "Compaction failed: %s\n", notmuch_status_to_string(ret));\r
+       return 1;\r
+     }\r
\r
+-    if (backup_path)\r
+-      printf ("The old database has been moved to %s.\n", backup_path);\r
++    if (! quiet) {\r
++      if (backup_path)\r
++          printf ("The old database has been moved to %s.\n", backup_path);\r
\r
+-    printf ("Done.\n");\r
++      printf ("Done.\n");\r
++    }\r
\r
+     return 0;\r
+ }\r
+-- \r
+1.8.4.rc3\r
+\r