- Implemented rc.verbose=on|off|list...
- Migrated rc.blanklines to a verbosity token.
- Updated documentation.
This commit is contained in:
Paul Beckingham 2011-05-11 21:49:31 -04:00
parent adc8605b06
commit 5fa77a36de
12 changed files with 65 additions and 13 deletions

View file

@ -28,6 +28,8 @@
report field. report field.
+ New 'indent.annotation' for the 'description.default' field format. + New 'indent.annotation' for the 'description.default' field format.
+ New 'color.label' for colorizing the report column labels. + New 'color.label' for colorizing the report column labels.
+ The 'blanklines' configuration variable now replaced by the 'verbose' token
'blanklines'.
# Tracked Features, sorted by ID. # Tracked Features, sorted by ID.
+ Added feature #330, which supports the 'inverse' color attribute. + Added feature #330, which supports the 'inverse' color attribute.

2
NEWS
View file

@ -15,6 +15,7 @@ New Features in taskwarrior 2.0.0
project, due date and description sorted by urgency). project, due date and description sorted by urgency).
- Performance enhancements. - Performance enhancements.
- New 'next' report, that gauges urgency and reports the most urgent tasks. - New 'next' report, that gauges urgency and reports the most urgent tasks.
- The 'blanklines' configuration variable replaced by 'verbose=...' tokens.
Please refer to the ChangeLog file for full details. There are too many to Please refer to the ChangeLog file for full details. There are too many to
list here. list here.
@ -36,6 +37,7 @@ New configuration options in taskwarrior 2.0.0
- New 'dependency.indicator' for the 'depends.indicator' report field format. - New 'dependency.indicator' for the 'depends.indicator' report field format.
- New 'indent.annotation' for the description.default field format. - New 'indent.annotation' for the description.default field format.
- New 'color.label' for report column labels. - New 'color.label' for report column labels.
- New 'verbose=...' support for individual verbosity settings.
Newly deprecated features in taskwarrior 2.0.0 Newly deprecated features in taskwarrior 2.0.0

View file

@ -184,8 +184,18 @@ help text.
.SS MISCELLANEOUS .SS MISCELLANEOUS
.TP .TP
.B verbose=yes .B edit.verbose=on|off|list...
Controls some of the verbosity of taskwarrior. When set to on (the default), helpful explanatory comments are added to the
edited file when using the "task edit ..." command. Setting this to off means
that you would see minimal output, with no help text.
Alternatively, you can specify a comma-separated list of verbosity tokens that
control specific occasions when output is generated. This list may contain:
blanklines Inserts extra blank lines in output, for clarity
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.
.TP .TP
.B confirmation=yes .B confirmation=yes

View file

@ -21,7 +21,7 @@ syn match taskrcVal ".\{-}$" contains=taskrcComment
syn match taskrcEqual "=" syn match taskrcEqual "="
syn match taskrcKey "^\s*.\{-}="he=e-1 contains=taskrcEqual syn match taskrcKey "^\s*.\{-}="he=e-1 contains=taskrcEqual
syn keyword taskrcGoodKey locking detection confirmation next bulk nag weekstart displayweeknumber defaultwidth editor monthsperline annotations _forcecolor blanklines debug hooks fontunderline syn keyword taskrcGoodKey locking detection confirmation next bulk nag weekstart displayweeknumber defaultwidth editor monthsperline annotations _forcecolor debug hooks fontunderline
syn match taskrcGoodKey "\(active\|tag\|recurrence\)\.indicator" syn match taskrcGoodKey "\(active\|tag\|recurrence\)\.indicator"
syn match taskrcGoodKey "alias\.\S\{-}="he=e-1 syn match taskrcGoodKey "alias\.\S\{-}="he=e-1

View file

@ -70,6 +70,8 @@ std::string Config::defaults =
"\n" "\n"
"# Miscellaneous\n" "# Miscellaneous\n"
"verbose=yes # Provide extra feedback\n" "verbose=yes # Provide extra feedback\n"
"#verbose=no # Provide minimal feedback\n"
"#verbose=blanklines # Provide controlled feedback\n"
"confirmation=yes # Confirmation on delete, big changes\n" "confirmation=yes # Confirmation on delete, big changes\n"
"echo.command=yes # Details on command just run\n" "echo.command=yes # Details on command just run\n"
"annotations=full # Level of verbosity for annotations: full, sparse or none\n" "annotations=full # Level of verbosity for annotations: full, sparse or none\n"

View file

@ -27,6 +27,7 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <algorithm>
#include <pwd.h> #include <pwd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -57,6 +58,7 @@ Context::Context ()
, cmd () , cmd ()
, dom () , dom ()
, use_color (true) , use_color (true)
, verbosity_legacy (false)
, inShadow (false) , inShadow (false)
, terminal_width (0) , terminal_width (0)
, terminal_height (0) , terminal_height (0)
@ -327,6 +329,24 @@ bool Context::color ()
config.getBoolean ("_forcecolor"); config.getBoolean ("_forcecolor");
} }
////////////////////////////////////////////////////////////////////////////////
bool Context::verbose (const std::string& token)
{
if (! verbosity.size ())
{
verbosity_legacy = config.getBoolean ("verbose");
split (verbosity, config.get ("verbose"), ',');
}
if (verbosity_legacy)
return true;
if (std::find (verbosity.begin (), verbosity.end (), token) != verbosity.end ())
return true;
return false;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Context::shadow () void Context::shadow ()
{ {

View file

@ -60,6 +60,7 @@ public:
int getHeight (); // determine terminal height int getHeight (); // determine terminal height
bool color (); // TTY or <other>? bool color (); // TTY or <other>?
bool verbose (const std::string&); // Verbosity control
void header (const std::string&); // Header message sink void header (const std::string&); // Header message sink
void footnote (const std::string&); // Footnote message sink void footnote (const std::string&); // Footnote message sink
@ -101,6 +102,8 @@ public:
DOM dom; DOM dom;
bool use_color; bool use_color;
bool verbosity_legacy;
std::vector <std::string> verbosity;
std::vector <std::string> headers; std::vector <std::string> headers;
std::vector <std::string> footnotes; std::vector <std::string> footnotes;
std::vector <std::string> debugMessages; std::vector <std::string> debugMessages;

View file

@ -216,7 +216,11 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
out += headers[c][i]; out += headers[c][i];
} }
out += extra + "\n"; out += extra;
// Trim right.
out.erase (out.find_last_not_of (" ") + 1);
out += "\n";
// Stop if the line limit is exceeded. // Stop if the line limit is exceeded.
if (++_lines >= _truncate_lines && _truncate_lines != 0) if (++_lines >= _truncate_lines && _truncate_lines != 0)
@ -269,7 +273,11 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
out += row_color.colorize (std::string (widths[c], ' ')); out += row_color.colorize (std::string (widths[c], ' '));
} }
out += (odd ? extra_odd : extra_even) + "\n"; out += (odd ? extra_odd : extra_even);
// Trim right.
out.erase (out.find_last_not_of (" ") + 1);
out += "\n";
// Stop if the line limit is exceeded. // Stop if the line limit is exceeded.
if (++_lines >= _truncate_lines && _truncate_lines != 0) if (++_lines >= _truncate_lines && _truncate_lines != 0)

View file

@ -200,7 +200,11 @@ std::string ViewText::render ()
out += headers[c][i]; out += headers[c][i];
} }
out += extra + "\n"; out += extra;
// Trim right.
out.erase (out.find_last_not_of (" ") + 1);
out += "\n";
// Stop if the line limit is exceeded. // Stop if the line limit is exceeded.
if (++_lines >= _truncate_lines && _truncate_lines != 0) if (++_lines >= _truncate_lines && _truncate_lines != 0)
@ -256,7 +260,11 @@ std::string ViewText::render ()
} }
} }
out += (odd ? extra_odd : extra_even) + "\n"; out += (odd ? extra_odd : extra_even);
// Trim right.
out.erase (out.find_last_not_of (" ") + 1);
out += "\n";
// Stop if the line limit is exceeded. // Stop if the line limit is exceeded.
if (++_lines >= _truncate_lines && _truncate_lines != 0) if (++_lines >= _truncate_lines && _truncate_lines != 0)

View file

@ -1093,7 +1093,7 @@ int handleShow (std::string& outs)
// Note that there is a leading and trailing space, to make it easier to // Note that there is a leading and trailing space, to make it easier to
// search for whole words. // search for whole words.
std::string recognized = std::string recognized =
" annotations blanklines bulk burndown.bias calendar.details calendar.details.report " " annotations bulk burndown.bias calendar.details calendar.details.report "
"calendar.holidays calendar.legend color calendar.offset calendar.offset.value " "calendar.holidays calendar.legend color calendar.offset calendar.offset.value "
"color.active color.due color.due.today color.blocked color.burndown.done " "color.active color.due color.due.today color.blocked color.burndown.done "
"color.burndown.pending color.burndown.started color.overdue color.pri.H " "color.burndown.pending color.burndown.started color.overdue color.pri.H "

View file

@ -269,7 +269,7 @@ int handleCustomReport (const std::string& report, std::string& outs)
// Adjust for fluff in the output. // Adjust for fluff in the output.
if (maxlines) if (maxlines)
maxlines -= (context.config.getBoolean ("blanklines") ? 1 : 0) maxlines -= (context.verbose ("blanklines") ? 1 : 0)
+ table_header + table_header
+ context.headers.size () + context.headers.size ()
+ context.footnotes.size (); + context.footnotes.size ();

View file

@ -402,10 +402,7 @@ std::string ucFirst (const std::string& input)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
const char* optionalBlankLine () const char* optionalBlankLine ()
{ {
if (context.config.getBoolean ("blanklines") == true) // no i18n return context.verbose ("blanklines") ? newline : noline;
return newline;
return noline;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////