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 B38F640B3C1 for ; Sat, 31 Aug 2013 23:09:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 yW0-0hcGZAbi for ; Sat, 31 Aug 2013 23:09:40 -0700 (PDT) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 9CA524092A2 for ; Sat, 31 Aug 2013 03:34:35 -0700 (PDT) Received: by mail-ea0-f176.google.com with SMTP id q16so1368329ead.21 for ; Sat, 31 Aug 2013 03:34:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ZnhhC7XApbFkgF9OpO+tRYHvFu2qFGDAUH/mfO1H2Hw=; b=iGiu/77GaysNVwv5jBPzzqCAImugIzdc7Ym3ex87ujSZBGxQ1AMgIgD2BRhdj349zR fDalnM7/vG3uDTxRHZfKP8BN1PrAtp+xoNX9wysT3c1guVhFR0gFEsILtFA0Rz9wq547 uREe0UYGUsas01q1SvPsuxR0QZCSKCD8ZYMkphIsOb182X8iVKxZgxKXVX4jcGqma2n8 Iijzr4xiuI38VC/e+eZYY4WFb7darL39t1jk46jUVCyqTAPwq1LMWaFHA9pTGgkT+9iV KSkBEeNR8/9YBmGqfo2nNk0kSg5j066zZKNjBhGHaUBYp7RuLYu/63Ch/aR6iVaOwqLr bFKQ== X-Gm-Message-State: ALoCoQke0PPh68k+FLybKt6+q4/IehUSTm7pu+chKjRhalkPUhJODMm1Z4FxVmjYfrPnqtva6+TF X-Received: by 10.14.177.199 with SMTP id d47mr19831814eem.14.1377945274394; Sat, 31 Aug 2013 03:34:34 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id a43sm4052382eep.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 31 Aug 2013 03:34:33 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [RFC PATCH 2/2] cli: use global verbose, debug, and no-hooks options in notmuch new Date: Sat, 31 Aug 2013 13:34:31 +0300 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org> References: <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org> In-Reply-To: <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org> References: <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org> 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: Sun, 01 Sep 2013 06:09:48 -0000 Deprecate the old notmuch new options, but keep them around for a transitional period, overriding the top level options. --- notmuch-new.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index faa33f1..d425103 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -855,16 +855,21 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) int opt_index; int i; notmuch_bool_t timer_is_active = FALSE; - notmuch_bool_t no_hooks = FALSE; + notmuch_bool_t no_hooks = notmuch_global_get_no_hooks (config); - add_files_state.verbose = FALSE; - add_files_state.debug = FALSE; + add_files_state.verbose = notmuch_global_get_verbose (config); + add_files_state.debug = notmuch_global_get_debug (config); add_files_state.output_is_a_tty = isatty (fileno (stdout)); + /* transitional, these will go away */ + notmuch_bool_t deprecated_verbose = FALSE; + notmuch_bool_t deprecated_debug = FALSE; + notmuch_bool_t deprecated_no_hooks = FALSE; + notmuch_opt_desc_t options[] = { - { NOTMUCH_OPT_BOOLEAN, &add_files_state.verbose, "verbose", 'v', 0 }, - { NOTMUCH_OPT_BOOLEAN, &add_files_state.debug, "debug", 'd', 0 }, - { NOTMUCH_OPT_BOOLEAN, &no_hooks, "no-hooks", 'n', 0 }, + { NOTMUCH_OPT_BOOLEAN, &deprecated_verbose, "verbose", 'v', 0 }, + { NOTMUCH_OPT_BOOLEAN, &deprecated_debug, "debug", 'd', 0 }, + { NOTMUCH_OPT_BOOLEAN, &deprecated_no_hooks, "no-hooks", 'n', 0 }, { 0, 0, 0, 0, 0 } }; @@ -874,6 +879,20 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) return 1; } + /* transitional, these will go away */ + if (deprecated_verbose) { + add_files_state.verbose = deprecated_verbose; + fprintf (stderr, "Note: 'notmuch new --verbose' is deprecated. Please use 'notmuch --verbose new' instead.\n"); + } + if (deprecated_debug) { + add_files_state.debug = deprecated_debug; + fprintf (stderr, "Note: 'notmuch new --debug' is deprecated. Please use 'notmuch --debug new' instead.\n"); + } + if (deprecated_no_hooks) { + no_hooks = deprecated_no_hooks; + fprintf (stderr, "Note: 'notmuch new --no-hooks' is deprecated. Please use 'notmuch --no-hooks new' instead.\n"); + } + add_files_state.new_tags = notmuch_config_get_new_tags (config, &add_files_state.new_tags_length); add_files_state.new_ignore = notmuch_config_get_new_ignore (config, &add_files_state.new_ignore_length); add_files_state.synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config); -- 1.7.10.4