[RFC PATCH 2/2] cli: use global verbose, debug, and no-hooks options in notmuch new
authorJani Nikula <jani@nikula.org>
Sat, 31 Aug 2013 10:34:31 +0000 (13:34 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:56:46 +0000 (09:56 -0800)
4f/328a7c2ac05da81b8bffe6b1935aa6c3c09425 [new file with mode: 0644]

diff --git a/4f/328a7c2ac05da81b8bffe6b1935aa6c3c09425 b/4f/328a7c2ac05da81b8bffe6b1935aa6c3c09425
new file mode 100644 (file)
index 0000000..0434e1c
--- /dev/null
@@ -0,0 +1,136 @@
+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 B38F640B3C1\r
+       for <notmuch@notmuchmail.org>; Sat, 31 Aug 2013 23:09:47 -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 yW0-0hcGZAbi for <notmuch@notmuchmail.org>;\r
+       Sat, 31 Aug 2013 23:09:40 -0700 (PDT)\r
+Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com\r
+       [209.85.215.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 9CA524092A2\r
+       for <notmuch@notmuchmail.org>; Sat, 31 Aug 2013 03:34:35 -0700 (PDT)\r
+Received: by mail-ea0-f176.google.com with SMTP id q16so1368329ead.21\r
+       for <notmuch@notmuchmail.org>; Sat, 31 Aug 2013 03:34:34 -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=ZnhhC7XApbFkgF9OpO+tRYHvFu2qFGDAUH/mfO1H2Hw=;\r
+       b=iGiu/77GaysNVwv5jBPzzqCAImugIzdc7Ym3ex87ujSZBGxQ1AMgIgD2BRhdj349zR\r
+       fDalnM7/vG3uDTxRHZfKP8BN1PrAtp+xoNX9wysT3c1guVhFR0gFEsILtFA0Rz9wq547\r
+       uREe0UYGUsas01q1SvPsuxR0QZCSKCD8ZYMkphIsOb182X8iVKxZgxKXVX4jcGqma2n8\r
+       Iijzr4xiuI38VC/e+eZYY4WFb7darL39t1jk46jUVCyqTAPwq1LMWaFHA9pTGgkT+9iV\r
+       KSkBEeNR8/9YBmGqfo2nNk0kSg5j066zZKNjBhGHaUBYp7RuLYu/63Ch/aR6iVaOwqLr\r
+       bFKQ==\r
+X-Gm-Message-State:\r
+ ALoCoQke0PPh68k+FLybKt6+q4/IehUSTm7pu+chKjRhalkPUhJODMm1Z4FxVmjYfrPnqtva6+TF\r
+X-Received: by 10.14.177.199 with SMTP id d47mr19831814eem.14.1377945274394;\r
+       Sat, 31 Aug 2013 03:34:34 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91])\r
+       by mx.google.com with ESMTPSA id a43sm4052382eep.9.1969.12.31.16.00.00\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 31 Aug 2013 03:34:33 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 2/2] cli: use global verbose, debug,\r
+       and no-hooks options in notmuch new\r
+Date: Sat, 31 Aug 2013 13:34:31 +0300\r
+Message-Id:\r
+ <d568247bc6b169e51a788611ebee2855705bdba0.1377945239.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To:\r
+ <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org>\r
+References:\r
+ <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org>\r
+In-Reply-To:\r
+ <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org>\r
+References:\r
+ <08036456064699510ef832f0c6740d98d324d185.1377945239.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: Sun, 01 Sep 2013 06:09:48 -0000\r
+\r
+Deprecate the old notmuch new options, but keep them around for a\r
+transitional period, overriding the top level options.\r
+---\r
+ notmuch-new.c |   31 +++++++++++++++++++++++++------\r
+ 1 file changed, 25 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index faa33f1..d425103 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -855,16 +855,21 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+     int opt_index;\r
+     int i;\r
+     notmuch_bool_t timer_is_active = FALSE;\r
+-    notmuch_bool_t no_hooks = FALSE;\r
++    notmuch_bool_t no_hooks = notmuch_global_get_no_hooks (config);\r
\r
+-    add_files_state.verbose = FALSE;\r
+-    add_files_state.debug = FALSE;\r
++    add_files_state.verbose = notmuch_global_get_verbose (config);\r
++    add_files_state.debug = notmuch_global_get_debug (config);\r
+     add_files_state.output_is_a_tty = isatty (fileno (stdout));\r
\r
++    /* transitional, these will go away */\r
++    notmuch_bool_t deprecated_verbose = FALSE;\r
++    notmuch_bool_t deprecated_debug = FALSE;\r
++    notmuch_bool_t deprecated_no_hooks = FALSE;\r
++\r
+     notmuch_opt_desc_t options[] = {\r
+-      { NOTMUCH_OPT_BOOLEAN,  &add_files_state.verbose, "verbose", 'v', 0 },\r
+-      { NOTMUCH_OPT_BOOLEAN,  &add_files_state.debug, "debug", 'd', 0 },\r
+-      { NOTMUCH_OPT_BOOLEAN,  &no_hooks, "no-hooks", 'n', 0 },\r
++      { NOTMUCH_OPT_BOOLEAN,  &deprecated_verbose, "verbose", 'v', 0 },\r
++      { NOTMUCH_OPT_BOOLEAN,  &deprecated_debug, "debug", 'd', 0 },\r
++      { NOTMUCH_OPT_BOOLEAN,  &deprecated_no_hooks, "no-hooks", 'n', 0 },\r
+       { 0, 0, 0, 0, 0 }\r
+     };\r
\r
+@@ -874,6 +879,20 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+       return 1;\r
+     }\r
\r
++    /* transitional, these will go away */\r
++    if (deprecated_verbose) {\r
++      add_files_state.verbose = deprecated_verbose;\r
++      fprintf (stderr, "Note: 'notmuch new --verbose' is deprecated. Please use 'notmuch --verbose new' instead.\n");\r
++    }\r
++    if (deprecated_debug) {\r
++      add_files_state.debug = deprecated_debug;\r
++      fprintf (stderr, "Note: 'notmuch new --debug' is deprecated. Please use 'notmuch --debug new' instead.\n");\r
++    }\r
++    if (deprecated_no_hooks) {\r
++      no_hooks = deprecated_no_hooks;\r
++      fprintf (stderr, "Note: 'notmuch new --no-hooks' is deprecated. Please use 'notmuch --no-hooks new' instead.\n");\r
++    }\r
++\r
+     add_files_state.new_tags = notmuch_config_get_new_tags (config, &add_files_state.new_tags_length);\r
+     add_files_state.new_ignore = notmuch_config_get_new_ignore (config, &add_files_state.new_ignore_length);\r
+     add_files_state.synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);\r
+-- \r
+1.7.10.4\r
+\r