From 1fb19671c4311e6a0e17d870acd1029406d959a8 Mon Sep 17 00:00:00 2001 From: Paul Fenwick Date: Fri, 24 Nov 2017 01:47:39 -0500 Subject: [PATCH] CLI2,Config: Add 'override' verbosity option This allows for 'override' messages to be silenced without requiring footnotes be completely disabled. The 'override' verbosity implies 'footnotes'. --- doc/man/taskrc.5.in | 7 ++++--- src/CLI2.cpp | 4 +++- src/Context.cpp | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 096860210..b3cc179fe 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -280,17 +280,18 @@ control specific occasions when output is generated. This list may contain: sync Feedback about sync filter Shows the filter used in the command unwait Notification when a task leaves the 'waiting' state + override Notification when configuration options are overriden recur Notification when a new recurring task instance is created -"affected", "new-id", "new-uuid" "project" and "unwait" imply "footnote". +"affected", "new-id", "new-uuid", "project", "override" and "unwait" imply "footnote". Note that the "1" setting is equivalent to all the tokens being specified, and the "nothing" setting is equivalent to none of the tokens being specified. Here are the shortcut equivalents: - verbose=1 - verbose=blank,header,footnote,label,new-id,affected,edit,special,project,sync,filter,unwait + verbose=on + verbose=blank,header,footnote,label,new-id,affected,edit,special,project,sync,filter,unwait,override verbose=0 verbose=blank,label,new-id,edit diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 516bb9504..0e68b38dc 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -299,7 +299,9 @@ void CLI2::applyOverrides (int argc, const char** argv) std::string name = raw.substr (3, sep - 3); std::string value = raw.substr (sep + 1); context.config.set (name, value); - context.footnote (format (STRING_PARSER_OVERRIDE_RC, name, value)); + + if (context.verbose("override")) + context.footnote (format (STRING_PARSER_OVERRIDE_RC, name, value)); } } } diff --git a/src/Context.cpp b/src/Context.cpp index fd59ae1bc..3c12187bf 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -88,7 +88,7 @@ std::string configurationDefaults = "\n" "# Miscellaneous\n" "# # Comma-separated list. May contain any subset of:\n" - "verbose=blank,header,footnote,label,new-id,new-uuid,affected,edit,special,project,sync,unwait,recur\n" + "verbose=blank,header,footnote,label,new-id,new-uuid,affected,edit,special,project,sync,unwait,override,recur\n" "confirmation=1 # Confirmation on delete, big changes\n" "recurrence=1 # Enable recurrence\n" "recurrence.confirmation=prompt # Confirmation for propagating changes among recurring tasks (yes/no/prompt)\n" @@ -949,6 +949,7 @@ bool Context::verbose (const std::string& token) v != "sync" && // v != "filter" && // v != "unwait" && // + v != "override" && // v != "recur") // { // This list emulates rc.verbose=off in version 1.9.4. @@ -960,7 +961,7 @@ bool Context::verbose (const std::string& token) if (! verbosity.count ("footnote")) { // TODO: Some of these may not use footnotes yet. They should. - for (auto flag : {"affected", "new-id", "new-uuid", "project", "unwait", "recur"}) + for (auto flag : {"affected", "new-id", "new-uuid", "project", "unwait", "override", "recur"}) { if (verbosity.count (flag)) {