mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 06:37:20 +02:00
Configuration Variable - due
- Added support for the "due" configuration variable that defines how many days into the future when a task is considered due.
This commit is contained in:
parent
6faf1e44f5
commit
01b3cb190c
7 changed files with 30 additions and 12 deletions
|
@ -12,6 +12,8 @@
|
||||||
+ "configure --enable-debug" now supported to suppress compiler optimization
|
+ "configure --enable-debug" now supported to suppress compiler optimization
|
||||||
to allow debugging.
|
to allow debugging.
|
||||||
+ Allow lower case priorities, and automatically upper case them.
|
+ Allow lower case priorities, and automatically upper case them.
|
||||||
|
+ Added support for "due" configuration variable which defines the number
|
||||||
|
of days in the future when a task is considered due.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,14 @@
|
||||||
Defaults to 80.
|
Defaults to 80.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt>due</dt>
|
||||||
|
<dd>
|
||||||
|
|
||||||
|
This is the number of days into the future that define when a
|
||||||
|
task is considered due, and is colored accordingly.
|
||||||
|
Defaults to 7.
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt>color</dt>
|
<dt>color</dt>
|
||||||
<dd>
|
<dd>
|
||||||
May be "on" or "off". Determines whether task uses color.
|
May be "on" or "off". Determines whether task uses color.
|
||||||
|
|
|
@ -104,6 +104,9 @@
|
||||||
which may be spelling mistakes or deprecated variables.
|
which may be spelling mistakes or deprecated variables.
|
||||||
<li>"configure --enable-debug" now supported to suppress compiler optimization
|
<li>"configure --enable-debug" now supported to suppress compiler optimization
|
||||||
to allow debugging.
|
to allow debugging.
|
||||||
|
<li>Allow lower case priorities, and automatically upper case them.
|
||||||
|
<li>Added support for "due" configuration variable which defines the number
|
||||||
|
of days in the future when a task is considered due.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -118,6 +118,7 @@ void Config::createDefault (const std::string& home)
|
||||||
fprintf (out, "monthsperline=1\n");
|
fprintf (out, "monthsperline=1\n");
|
||||||
fprintf (out, "curses=on\n");
|
fprintf (out, "curses=on\n");
|
||||||
fprintf (out, "color=on\n");
|
fprintf (out, "color=on\n");
|
||||||
|
fprintf (out, "due=7\n");
|
||||||
|
|
||||||
fprintf (out, "color.overdue=bold_red\n");
|
fprintf (out, "color.overdue=bold_red\n");
|
||||||
fprintf (out, "#color.due=on_bright_yellow\n");
|
fprintf (out, "#color.due=on_bright_yellow\n");
|
||||||
|
|
|
@ -258,7 +258,7 @@ std::string handleList (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ std::string handleSmallList (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ std::string handleCompleted (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
}
|
}
|
||||||
|
@ -851,7 +851,7 @@ std::string handleLongList (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
@ -1180,7 +1180,7 @@ std::string handleReportNext (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
@ -1962,7 +1962,7 @@ std::string handleReportActive (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
@ -2076,7 +2076,7 @@ std::string handleReportOverdue (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
@ -2220,7 +2220,7 @@ std::string handleReportOldest (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
@ -2368,7 +2368,7 @@ std::string handleReportNewest (TDB& tdb, T& task, Config& conf)
|
||||||
{
|
{
|
||||||
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
Text::color fg = Text::colorCode (refTask.getAttribute ("fg"));
|
||||||
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
Text::color bg = Text::colorCode (refTask.getAttribute ("bg"));
|
||||||
autoColorize (refTask, fg, bg);
|
autoColorize (refTask, fg, bg, conf);
|
||||||
table.setRowFg (row, fg);
|
table.setRowFg (row, fg);
|
||||||
table.setRowBg (row, bg);
|
table.setRowBg (row, bg);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,11 @@ void initializeColorRules (Config& conf)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void autoColorize (T& task, Text::color& fg, Text::color& bg)
|
void autoColorize (
|
||||||
|
T& task,
|
||||||
|
Text::color& fg,
|
||||||
|
Text::color& bg,
|
||||||
|
Config& conf)
|
||||||
{
|
{
|
||||||
// Note: fg, bg already contain colors specifically assigned via command.
|
// Note: fg, bg already contain colors specifically assigned via command.
|
||||||
// Note: These rules form a hierarchy - the last rule is king.
|
// Note: These rules form a hierarchy - the last rule is king.
|
||||||
|
@ -159,7 +163,7 @@ void autoColorize (T& task, Text::color& fg, Text::color& bg)
|
||||||
{
|
{
|
||||||
Date dueDate (::atoi (due.c_str ()));
|
Date dueDate (::atoi (due.c_str ()));
|
||||||
Date now;
|
Date now;
|
||||||
Date then (now + 7 * 86400);
|
Date then (now + conf.get ("due", 7) * 86400);
|
||||||
|
|
||||||
// Overdue
|
// Overdue
|
||||||
if (dueDate < now)
|
if (dueDate < now)
|
||||||
|
|
|
@ -141,6 +141,6 @@ std::string expandPath (const std::string&);
|
||||||
|
|
||||||
// rules.cpp
|
// rules.cpp
|
||||||
void initializeColorRules (Config&);
|
void initializeColorRules (Config&);
|
||||||
void autoColorize (T&, Text::color&, Text::color&);
|
void autoColorize (T&, Text::color&, Text::color&, Config&);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue