Feature #391 - legendary enhancement

- Added feature #391, now the 'task color legend' command will show
  samples of all the defined colors and color rules from your .taskrc
  and theme.
This commit is contained in:
Paul Beckingham 2010-07-25 14:50:20 -04:00
parent 7dc55d831d
commit 43266a825f
6 changed files with 49 additions and 7 deletions

View file

@ -4,6 +4,9 @@
1.9.3 () 1.9.3 ()
+ Added feature #189, that records the start and stop times + Added feature #189, that records the start and stop times
as an annotation for a task. as an annotation for a task.
+ Added feature #391, now the 'task color legend' command will show
samples of all the defined colors and color rules from your .taskrc
and theme.
+ Added feature #423, now custom report filters allow rc overrides. + Added feature #423, now custom report filters allow rc overrides.
+ Added feature #428, preparing the new structure for the NEWS file. + Added feature #428, preparing the new structure for the NEWS file.
+ Added feature #429, which improves the 'all' report to exclude deleted. + Added feature #429, which improves the 'all' report to exclude deleted.

3
NEWS
View file

@ -9,7 +9,8 @@ New Features in task 1.9.3
New commands in task 1.9.3 New commands in task 1.9.3
- - New 'task color legend' command will show samples of all the defined colors
and color rules from your .taskrc and theme.
- -
New configuration options in task 1.9.3 New configuration options in task 1.9.3

View file

@ -193,6 +193,15 @@ color1, and proceed. Note that red and color1 are not quite the same.
Note also that there is no bold or bright attributes when dealing with 256 Note also that there is no bold or bright attributes when dealing with 256
colors, but there is still underline available. colors, but there is still underline available.
.SH LEGEND
Task will show examples of all defined colors used in your .taskrc, or theme,
if you run this command:
$ task color legend
This gives you an example of each of the colors, so you can see the effect,
without necessarily creating a set of tasks that meet each of the rule criteria.
.SH RULES .SH RULES
Task supports colorization rules. These are configuration values that specify Task supports colorization rules. These are configuration values that specify
a color, and the conditions under which that color is used. By example, let's a color, and the conditions under which that color is used. By example, let's

View file

@ -133,8 +133,9 @@ Exports all tasks in iCalendar format.
Redirect the output to a file, if you wish to save it, or pipe it to another command. Redirect the output to a file, if you wish to save it, or pipe it to another command.
.TP .TP
.B color [sample] .B color [sample | legend]
Displays all possible colors, or a sample. Displays all possible colors, a named sample, or a legend containing all
currently defined colors.
.TP .TP
.B version .B version

View file

@ -1863,10 +1863,36 @@ int handleColor (std::string &outs)
if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor")) if (context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor"))
{ {
// If the description contains 'legend', show all the colors currently in
// use.
std::string description = context.task.get ("description");
if (description.find ("legend") != std::string::npos)
{
out << std::endl
<< "Here are the colors currently in use:"
<< std::endl;
std::vector <std::string> all;
context.config.all (all);
foreach (item, all)
{
if (*item != "_forcecolor" &&
*item != "color" &&
item->find ("color") != std::string::npos)
{
out << " "
<< Color::colorize (" " + *item + " ",
context.config.get (*item))
<< std::endl;
}
}
out << std::endl;
}
// If there is something in the description, then assume that is a color, // If there is something in the description, then assume that is a color,
// and display it as a sample. // and display it as a sample.
std::string description = context.task.get ("description"); else if (description != "")
if (description != "")
{ {
Color one ("black on bright yellow"); Color one ("black on bright yellow");
Color two ("underline cyan on bright blue"); Color two ("underline cyan on bright blue");

View file

@ -24,6 +24,7 @@
// USA // USA
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
@ -205,8 +206,9 @@ int shortUsage (std::string &outs)
table.addCell (row, 2, "Lists all tasks in iCalendar format."); table.addCell (row, 2, "Lists all tasks in iCalendar format.");
row = table.addRow (); row = table.addRow ();
table.addCell (row, 1, "task color [sample]"); table.addCell (row, 1, "task color [sample | legend]");
table.addCell (row, 2, "Displays all possible colors, or a sample."); table.addCell (row, 2, "Displays all possible colors, a named sample, or a "
"legend containing all currently defined colors.");
row = table.addRow (); row = table.addRow ();
table.addCell (row, 1, "task version"); table.addCell (row, 1, "task version");