Feature TW-1260

- TW-1260 New virtual tags YESTERDAY, TOMORROW.
This commit is contained in:
Paul Beckingham 2014-02-15 14:36:49 -05:00
parent 1170a43f6b
commit b9c853fece
5 changed files with 44 additions and 6 deletions

View file

@ -10,6 +10,7 @@ Features
+ TW-261 Easy to create "not deletable" task (thanks to Jan Kunder).
+ TW-1255 New testing framework (thanks to Renato Alves).
+ TW-1258 Portuguese Localization (thanks to Renato Alves).
+ TW-1260 New virtual tags YESTERDAY, TOMORROW.
+ Removed deprecated 'echo.command' setting, in favor of the 'header' and
'affected' verbosity tokens.
+ Removed deprecated 'edit.verbose' setting, in favor of the 'edit' verbosity

1
NEWS
View file

@ -5,6 +5,7 @@ New Features in taskwarrior 2.4.0
- Removed deprecated commands 'push', 'pull' and 'merge'.
- Portuguese (por-PRT) localization.
- Better handling for deletion of recurring tasks.
- New virtual tags: YESTERDAY, TOMORROW.
New commands in taskwarrior 2.4.0

View file

@ -571,9 +571,11 @@ are:
BLOCKED Matches if the task is blocked
UNBLOCKED Matches if the task is not blocked
BLOCKING Matches if the task is blocking
YESTERDAY Matches if the task was due sometime yesterday
DUE Matches if the task is due
DUETODAY Matches if the task is due today
TODAY Matches if the task is due today
TOMORROW Matches if the task is due sometime tomorrow
WEEK Matches if the task is due this week
MONTH Matches if the task is due this month
YEAR Matches if the task is due this year

View file

@ -342,6 +342,24 @@ bool Task::is_due () const
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_dueyesterday () const
{
if (has ("due"))
{
Task::status status = getStatus ();
if (status != Task::completed &&
status != Task::deleted)
{
if (Date ("yesterday").sameDay (get_date ("due")))
return true;
}
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_duetoday () const
{
@ -360,6 +378,24 @@ bool Task::is_duetoday () const
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_duetomorrow () const
{
if (has ("due"))
{
Task::status status = getStatus ();
if (status != Task::completed &&
status != Task::deleted)
{
if (Date ("tomorrow").sameDay (get_date ("due")))
return true;
}
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Task::is_dueweek () const
{
@ -1081,6 +1117,8 @@ bool Task::hasTag (const std::string& tag) const
if (tag == "DUE") return is_due ();
if (tag == "DUETODAY") return is_duetoday ();
if (tag == "TODAY") return is_duetoday ();
if (tag == "YESTERDAY") return is_dueyesterday ();
if (tag == "TOMORROW") return is_duetomorrow ();
if (tag == "OVERDUE") return is_overdue ();
if (tag == "WEEK") return is_dueweek ();
if (tag == "MONTH") return is_duemonth ();
@ -1094,12 +1132,6 @@ bool Task::hasTag (const std::string& tag) const
if (tag == "ANNOTATED") return hasAnnotations ();
if (tag == "PARENT") return has ("mask");
/*
TODO YESTERDAY - due yesterday
TODO TOMORROW - due tomorrow
TODO READY - is ready
*/
// Concrete tags.
std::vector <std::string> tags;
split (tags, get ("tags"), ',');

View file

@ -104,7 +104,9 @@ public:
#ifdef PRODUCT_TASKWARRIOR
bool is_due () const;
bool is_dueyesterday () const;
bool is_duetoday () const;
bool is_duetomorrow () const;
bool is_dueweek () const;
bool is_duemonth () const;
bool is_dueyear () const;