mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
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:
parent
7dc55d831d
commit
43266a825f
6 changed files with 49 additions and 7 deletions
|
@ -4,6 +4,9 @@
|
|||
1.9.3 ()
|
||||
+ Added feature #189, that records the start and stop times
|
||||
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 #428, preparing the new structure for the NEWS file.
|
||||
+ Added feature #429, which improves the 'all' report to exclude deleted.
|
||||
|
|
3
NEWS
3
NEWS
|
@ -9,7 +9,8 @@ New Features 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
|
||||
|
|
|
@ -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
|
||||
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
|
||||
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
|
||||
|
|
|
@ -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.
|
||||
|
||||
.TP
|
||||
.B color [sample]
|
||||
Displays all possible colors, or a sample.
|
||||
.B color [sample | legend]
|
||||
Displays all possible colors, a named sample, or a legend containing all
|
||||
currently defined colors.
|
||||
|
||||
.TP
|
||||
.B version
|
||||
|
|
|
@ -1863,10 +1863,36 @@ int handleColor (std::string &outs)
|
|||
|
||||
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,
|
||||
// and display it as a sample.
|
||||
std::string description = context.task.get ("description");
|
||||
if (description != "")
|
||||
else if (description != "")
|
||||
{
|
||||
Color one ("black on bright yellow");
|
||||
Color two ("underline cyan on bright blue");
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
@ -205,8 +206,9 @@ int shortUsage (std::string &outs)
|
|||
table.addCell (row, 2, "Lists all tasks in iCalendar format.");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task color [sample]");
|
||||
table.addCell (row, 2, "Displays all possible colors, or a sample.");
|
||||
table.addCell (row, 1, "task color [sample | legend]");
|
||||
table.addCell (row, 2, "Displays all possible colors, a named sample, or a "
|
||||
"legend containing all currently defined colors.");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task version");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue