[RFC PATCH 2/2] cli: use global verbose, debug, and no-hooks options in notmuch new
Jani Nikula
jani at nikula.org
Sat Aug 31 03:34:31 PDT 2013
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
More information about the notmuch
mailing list