mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +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
|
@ -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