mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
- Added three new colorization rules - color.tag.x, color.project.x, color.keyword.x.
- Updated default .taskrc file. - Updated docs accordingly.
This commit is contained in:
parent
039c3119ff
commit
f73c64801c
4 changed files with 56 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
|||
+ Bug: incorrect color specification in sample .taskrc file
|
||||
+ Bug: when run without arguments, task dumps core on Solaris 10
|
||||
+ "task calendar" now reports all months with due pending tasks
|
||||
+ Added rules for colorization by tag, project and keyword
|
||||
|
||||
0.9.9 (5/27/2008)
|
||||
+ Autoconf/automake behaving properly.
|
||||
|
|
7
TUTORIAL
7
TUTORIAL
|
@ -29,7 +29,7 @@ transcript illustrates a typical installation:
|
|||
...
|
||||
% make
|
||||
...
|
||||
% make install
|
||||
% make install # (may require sudo, depending on --prefix)
|
||||
|
||||
You need to make sure that the installed task program is in your PATH
|
||||
environment variable.
|
||||
|
@ -617,6 +617,11 @@ Configuring Task
|
|||
|
||||
bold_red on_bright_yellow
|
||||
|
||||
color.tag.X Colors any task that has the tag X.
|
||||
|
||||
color.project.X Colors any task assigned to project X.
|
||||
|
||||
color.keyword.X Colors any task where the description contains X.
|
||||
|
||||
|
||||
Colors
|
||||
|
|
|
@ -107,6 +107,7 @@ void Config::createDefault (const std::string& file)
|
|||
|
||||
if (taskDir != "")
|
||||
{
|
||||
// Create a sample .taskrc file.
|
||||
FILE* out;
|
||||
if ((out = fopen (file.c_str (), "w")))
|
||||
{
|
||||
|
@ -125,9 +126,13 @@ void Config::createDefault (const std::string& file)
|
|||
fprintf (out, "#color.pri.L=on_green\n");
|
||||
fprintf (out, "color.active=bold_cyan\n");
|
||||
fprintf (out, "color.tagged=yellow\n");
|
||||
fprintf (out, "#color.tag.bug=yellow\n");
|
||||
fprintf (out, "#color.project.home=on_green\n");
|
||||
fprintf (out, "#color.keyword.car=on_blue\n");
|
||||
|
||||
fclose (out);
|
||||
|
||||
// Now set the live values.
|
||||
set ("data.location", taskDir);
|
||||
set ("command.logging", "off");
|
||||
set ("confirmation", "yes");
|
||||
|
|
|
@ -83,6 +83,7 @@ void initializeColorRules (Config& conf)
|
|||
void autoColorize (T& task, Text::color& fg, Text::color& bg)
|
||||
{
|
||||
// Note: fg, bg already contain colors specifically assigned via command.
|
||||
// TODO These rules form a hierarchy - the last rule is king.
|
||||
|
||||
// Colorization of the tagged.
|
||||
if (gsFg["color.tagged"] != Text::nocolor ||
|
||||
|
@ -174,6 +175,49 @@ void autoColorize (T& task, Text::color& fg, Text::color& bg)
|
|||
bg = gsBg["color.due"];
|
||||
}
|
||||
}
|
||||
|
||||
// Colorization by tag value.
|
||||
std::map <std::string, Text::color>::iterator it;
|
||||
for (it = gsFg.begin (); it != gsFg.end (); ++it)
|
||||
{
|
||||
if (it->first.substr (0, 10) == "color.tag.")
|
||||
{
|
||||
std::string value = it->first.substr (10, std::string::npos);
|
||||
if (task.hasTag (value))
|
||||
{
|
||||
fg = gsFg[it->first];
|
||||
bg = gsBg[it->first];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Colorization by project name.
|
||||
for (it = gsFg.begin (); it != gsFg.end (); ++it)
|
||||
{
|
||||
if (it->first.substr (0, 14) == "color.project.")
|
||||
{
|
||||
std::string value = it->first.substr (14, std::string::npos);
|
||||
if (task.getAttribute ("project") == value)
|
||||
{
|
||||
fg = gsFg[it->first];
|
||||
bg = gsBg[it->first];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Colorization by keyword.
|
||||
for (it = gsFg.begin (); it != gsFg.end (); ++it)
|
||||
{
|
||||
if (it->first.substr (0, 14) == "color.keyword.")
|
||||
{
|
||||
std::string value = it->first.substr (14, std::string::npos);
|
||||
if (task.getDescription ().find (value) != std::string::npos)
|
||||
{
|
||||
fg = gsFg[it->first];
|
||||
bg = gsBg[it->first];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue