mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 19:03:07 +02:00
Feature
- New virtual tags (WEEK, MONTH, YEAR, PARENT).
This commit is contained in:
parent
3a8a513d17
commit
bc41e7378a
5 changed files with 76 additions and 6 deletions
|
@ -36,6 +36,7 @@ Features
|
|||
specifying \uNNNN.
|
||||
+ Now requires libuuid (thanks to Martin Natano).
|
||||
+ New '_get' is a DOM accessor helper command.
|
||||
+ New virtual tags (WEEK, MONTH, YEAR, PARENT).
|
||||
|
||||
Bugs
|
||||
+ #1196 Now builds on Hurd (thanks to Jakub Wilk).
|
||||
|
@ -89,7 +90,7 @@ Features
|
|||
+ Removed deprecated 'fg:' and 'bg:' attributes.
|
||||
+ The 'diagnostics' command now reports libuuid details.
|
||||
+ New characters for parsing and formating dates ('n', 's' and 'v').
|
||||
+ Virtual tags (BLOCKED, UNBLOCKED, BLOCKING, DUE, DUETODAY, TODAY, OVERDUE,
|
||||
+ Virtual tags (BLOCKED, UNBLOCKED, BLOCKING, DUE, DUETODAY, OVERDUE, TODAY,
|
||||
ACTIVE, SCHEDULED, CHILD, UNTIL, WAITING and ANNOTATED).
|
||||
+ New 'modified' attribute, which contains the most recent modification date,
|
||||
if a modification has occurred.
|
||||
|
|
1
NEWS
1
NEWS
|
@ -8,6 +8,7 @@ New Features in taskwarrior 2.3.0
|
|||
- UDA fields now allow default values.
|
||||
- Now requires libuuid.
|
||||
- New '_get' DOM accessor helper command.
|
||||
- New virtual tags: WEEK, MONTH, YEAR, PARENT.
|
||||
|
||||
New commands in taskwarrior 2.3.0
|
||||
|
||||
|
|
|
@ -588,9 +588,13 @@ are:
|
|||
DUE Matches if the task is due
|
||||
DUETODAY Matches if the task is due today
|
||||
TODAY Matches if the task is due today
|
||||
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
|
||||
OVERDUE Matches if the task is overdue
|
||||
ACTIVE Matches if the task is started
|
||||
SCHEDULED Matches if the task is scheduled
|
||||
PARENT Matches if the task is a parent
|
||||
CHILD Matches if the task has a parent
|
||||
UNTIL Matches if the task expires
|
||||
WAITING Matches if the task is waiting
|
||||
|
|
71
src/Task.cpp
71
src/Task.cpp
|
@ -361,6 +361,68 @@ bool Task::is_duetoday () const
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::is_dueweek () const
|
||||
{
|
||||
if (has ("due"))
|
||||
{
|
||||
Task::status status = getStatus ();
|
||||
|
||||
if (status != Task::completed &&
|
||||
status != Task::deleted)
|
||||
{
|
||||
Date now;
|
||||
Date due (get_date ("due"));
|
||||
if (now.year () == due.year () &&
|
||||
now.week () == due.week ())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::is_duemonth () const
|
||||
{
|
||||
if (has ("due"))
|
||||
{
|
||||
Task::status status = getStatus ();
|
||||
|
||||
if (status != Task::completed &&
|
||||
status != Task::deleted)
|
||||
{
|
||||
Date now;
|
||||
Date due (get_date ("due"));
|
||||
if (now.year () == due.year () &&
|
||||
now.month () == due.month ())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::is_dueyear () const
|
||||
{
|
||||
if (has ("due"))
|
||||
{
|
||||
Task::status status = getStatus ();
|
||||
|
||||
if (status != Task::completed &&
|
||||
status != Task::deleted)
|
||||
{
|
||||
Date now;
|
||||
Date due (get_date ("due"));
|
||||
if (now.year () == due.year ())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Task::is_overdue () const
|
||||
{
|
||||
|
@ -1026,6 +1088,9 @@ bool Task::hasTag (const std::string& tag) const
|
|||
if (tag == "DUETODAY") return is_duetoday ();
|
||||
if (tag == "TODAY") return is_duetoday ();
|
||||
if (tag == "OVERDUE") return is_overdue ();
|
||||
if (tag == "WEEK") return is_dueweek ();
|
||||
if (tag == "MONTH") return is_duemonth ();
|
||||
if (tag == "YEAR") return is_dueyear ();
|
||||
#endif
|
||||
if (tag == "ACTIVE") return has ("start");
|
||||
if (tag == "SCHEDULED") return has ("scheduled");
|
||||
|
@ -1033,16 +1098,12 @@ bool Task::hasTag (const std::string& tag) const
|
|||
if (tag == "UNTIL") return has ("until");
|
||||
if (tag == "WAITING") return has ("wait");
|
||||
if (tag == "ANNOTATED") return hasAnnotations ();
|
||||
if (tag == "PARENT") return has ("mask");
|
||||
|
||||
/*
|
||||
TODO YESTERDAY - due yesterday
|
||||
TODO TOMORROW - due tomorrow
|
||||
TODO WEEK - due this week
|
||||
TODO MONTH - due this month
|
||||
TODO YEAR - due this year
|
||||
TODO READY - is ready
|
||||
TODO WAITING - is waiting
|
||||
TODO PARENT - is a parent
|
||||
*/
|
||||
|
||||
// Concrete tags.
|
||||
|
|
|
@ -106,6 +106,9 @@ public:
|
|||
#ifdef PRODUCT_TASKWARRIOR
|
||||
bool is_due () const;
|
||||
bool is_duetoday () const;
|
||||
bool is_dueweek () const;
|
||||
bool is_duemonth () const;
|
||||
bool is_dueyear () const;
|
||||
bool is_overdue () const;
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue