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'.
This commit is contained in:
Paul Fenwick 2017-11-24 01:47:39 -05:00 committed by Paul Beckingham
parent aefe16a6e2
commit ec31b93447
3 changed files with 10 additions and 6 deletions

View file

@ -280,17 +280,18 @@ control specific occasions when output is generated. This list may contain:
sync Feedback about sync sync Feedback about sync
filter Shows the filter used in the command filter Shows the filter used in the command
unwait Notification when a task leaves the 'waiting' state 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 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, 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. and the "nothing" setting is equivalent to none of the tokens being specified.
Here are the shortcut equivalents: Here are the shortcut equivalents:
verbose=1 verbose=on
verbose=blank,header,footnote,label,new-id,affected,edit,special,project,sync,filter,unwait verbose=blank,header,footnote,label,new-id,affected,edit,special,project,sync,filter,unwait,override
verbose=0 verbose=0
verbose=blank,label,new-id,edit verbose=blank,label,new-id,edit

View file

@ -299,6 +299,8 @@ void CLI2::applyOverrides (int argc, const char** argv)
std::string name = raw.substr (3, sep - 3); std::string name = raw.substr (3, sep - 3);
std::string value = raw.substr (sep + 1); std::string value = raw.substr (sep + 1);
context.config.set (name, value); context.config.set (name, value);
if (context.verbose("override"))
context.footnote (format (STRING_PARSER_OVERRIDE_RC, name, value)); context.footnote (format (STRING_PARSER_OVERRIDE_RC, name, value));
} }
} }

View file

@ -88,7 +88,7 @@ std::string configurationDefaults =
"\n" "\n"
"# Miscellaneous\n" "# Miscellaneous\n"
"# # Comma-separated list. May contain any subset of:\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" "confirmation=1 # Confirmation on delete, big changes\n"
"recurrence=1 # Enable recurrence\n" "recurrence=1 # Enable recurrence\n"
"recurrence.confirmation=prompt # Confirmation for propagating changes among recurring tasks (yes/no/prompt)\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 != "sync" && //
v != "filter" && // v != "filter" && //
v != "unwait" && // v != "unwait" && //
v != "override" && //
v != "recur") // v != "recur") //
{ {
// This list emulates rc.verbose=off in version 1.9.4. // 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")) if (! verbosity.count ("footnote"))
{ {
// TODO: Some of these may not use footnotes yet. They should. // 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)) if (verbosity.count (flag))
{ {