Feature #571 - Special tag feedback

- The verbosity token 'special' now controls whether the feedback is provided
  when special tags are added to a task.
- Added new 'special' verbosity token documentation to man page.
- Added missing 'next' special tag to man page.
- Added new localized strings for describing special tags.
This commit is contained in:
Paul Beckingham 2012-01-29 18:28:07 -05:00
parent bf9e14f581
commit 5609711d47
9 changed files with 39 additions and 1 deletions

View file

@ -71,6 +71,8 @@
+ Added feature #559, that causes Taskwarrior to exit if the ~/.task (or
rc.data.location override) does not exist, controlled by the
rc.exit.on.missing.db configuration variable (thanks to Sander Marechal).
+ Added feature #571, which provides descriptive feedback when a special tag
is applied.
+ Added feature #607, which allows modification of a task during annotation
(thanks to Peter De Poorter).
+ Added feature #612, so that the 'info' command displays the sum of all

View file

@ -487,6 +487,7 @@ exempt from all color rules. The supported special tags are:
+nocolor Disable color rules processing for this task
+nonag Completion of this task suppresses all nag messages
+nocal This task will not appear on the calendar
+next Elevates task so it appears on 'next' report
.TP
.B project:<project-name>

View file

@ -225,6 +225,7 @@ control specific occasions when output is generated. This list may contain:
new-id Provides feedback of any new task IDs
affected Reports 'N tasks affected' and similar
edit Used the verbose template for the 'edit' command
special Feedback when applying special tags
Note that the "on" setting is equivalent to all the tokens being specified,
and the "off" setting is equivalent to none of the tokens being specified.

View file

@ -82,7 +82,7 @@ std::string Config::_defaults =
"verbose=yes # Provide maximal feedback\n"
"#verbose=no # Provide minimal feedback\n"
"#verbose=list # Comma-separated list. May contain any subset of:\n"
"#verbose=blank,header,footnote,label,new-id,affected,edit\n"
"#verbose=blank,header,footnote,label,new-id,affected,edit,special\n"
"confirmation=yes # Confirmation on delete, big changes\n"
"echo.command=yes # Details on command just run. Deprecated\n"
"annotations=full # Level of verbosity for annotations: full, sparse or none\n"

View file

@ -520,7 +520,10 @@ void Command::modify_task (
A3::extract_tag (arg._raw, type, value);
if (type == '+')
{
task.addTag (value);
feedback_special_tags (task, value);
}
else
task.removeTag (value);
}

View file

@ -680,6 +680,10 @@
#define STRING_FEEDBACK_ANN_WAS_MOD "Annotation changed to '{1}'."
#define STRING_FEEDBACK_NOP "No changes will be made."
#define STRING_FEEDBACK_WAS_NOP "No changes made."
#define STRING_FEEDBACK_TAG_NOCOLOR "The 'nocolor' special tag will disable color rules for this task."
#define STRING_FEEDBACK_TAG_NONAG "The 'nonag' special tag will prevent nagging when this task is modified."
#define STRING_FEEDBACK_TAG_NOCAL "The 'nocal' special tag will keep this task off the calendar report."
#define STRING_FEEDBACK_TAG_NEXT "The 'next' special tag will boost the urgency of this task so it appears on the 'next' report."
// File
#define STRING_FILE_PERMS "Task does not have the correct permissions for '{1}'."

View file

@ -340,4 +340,29 @@ void feedback_affected (const std::string& effect, const Task& task)
}
////////////////////////////////////////////////////////////////////////////////
// Implements feedback when adding special tags to a task.
void feedback_special_tags (const Task& task, const std::string& tag)
{
if (context.verbose ("special"))
{
std::string msg;
std::string explanation;
if (tag == "nocolor") msg = STRING_FEEDBACK_TAG_NOCOLOR;
else if (tag == "nonag") msg = STRING_FEEDBACK_TAG_NONAG;
else if (tag == "nocal") msg = STRING_FEEDBACK_TAG_NOCAL;
else if (tag == "next") msg = STRING_FEEDBACK_TAG_NEXT;
if (msg.length ())
{
if (task.id)
std::cout << format (msg, task.id)
<< "\n";
else
std::cout << format (msg, task.get ("uuid"))
<< "\n";
}
}
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -77,6 +77,7 @@ std::string renderAttribute (const std::string&, const std::string&);
void feedback_affected (const std::string&);
void feedback_affected (const std::string&, int);
void feedback_affected (const std::string&, const Task&);
void feedback_special_tags (const Task&, const std::string&);
// sort.cpp
void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);

View file

@ -65,6 +65,7 @@ unlike ($output, qr/^\d+ tasks$/ms, '\'footer\' verbosity good');
# TODO Verbosity: 'blank'
# TODO Verbosity: 'header'
# TODO Verbosity: 'edit'
# TODO Verbosity: 'special'
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data synch.key verbose.rc);