mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Virtual Tags: New 'PROJECT', 'PRIORITY' and 'LATEST' virtual tags
- Added documentation.
This commit is contained in:
parent
ada6c24789
commit
4008a64fdd
6 changed files with 64 additions and 47 deletions
|
@ -153,7 +153,7 @@
|
||||||
Shahaf).
|
Shahaf).
|
||||||
- When multiple tasks are 'edit'ed, a failure causes the editing to stop (thanks
|
- When multiple tasks are 'edit'ed, a failure causes the editing to stop (thanks
|
||||||
to Daniel Shahaf).
|
to Daniel Shahaf).
|
||||||
- New 'UDA' and 'ORPHAN' virtual tags.
|
- New 'UDA', 'ORPHAN', 'PROJECT', 'PRIORITY' and 'LATEST' virtual tags.
|
||||||
- Commands that do not accept filters or modifications now generate an error
|
- Commands that do not accept filters or modifications now generate an error
|
||||||
when extra arguments are specified.
|
when extra arguments are specified.
|
||||||
- Improved zsh support (thanks to Daniel Shahaf).
|
- Improved zsh support (thanks to Daniel Shahaf).
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -3,7 +3,7 @@ New Features in Taskwarrior 2.4.5
|
||||||
|
|
||||||
- The active context, if one is set, is now identified in "task context list"
|
- The active context, if one is set, is now identified in "task context list"
|
||||||
- It is an error to attempt adding or removing a virtual tag.
|
- It is an error to attempt adding or removing a virtual tag.
|
||||||
- New 'UDA' and 'ORPHAN' virtual tags.
|
- New 'UDA', 'ORPHAN', 'PROJECT', 'PRIORITY' and 'LATEST' virtual tags.
|
||||||
|
|
||||||
New commands in Taskwarrior 2.4.5
|
New commands in Taskwarrior 2.4.5
|
||||||
|
|
||||||
|
|
|
@ -665,11 +665,14 @@ are:
|
||||||
DELETED Matches if the task has deleted status
|
DELETED Matches if the task has deleted status
|
||||||
DUE Matches if the task is due
|
DUE Matches if the task is due
|
||||||
DUETODAY Matches if the task is due today
|
DUETODAY Matches if the task is due today
|
||||||
|
LATEST Matches if the task is the newest added task
|
||||||
MONTH Matches if the task is due this month
|
MONTH Matches if the task is due this month
|
||||||
ORPHAN Matches if the task has any orphaned UDA values
|
ORPHAN Matches if the task has any orphaned UDA values
|
||||||
OVERDUE Matches if the task is overdue
|
OVERDUE Matches if the task is overdue
|
||||||
PARENT Matches if the task is a parent
|
PARENT Matches if the task is a parent
|
||||||
PENDING Matches if the task has pending status
|
PENDING Matches if the task has pending status
|
||||||
|
PRIORITY Matches if the task has a priority
|
||||||
|
PROJECT Matches if the task has a project
|
||||||
READY Matches if the task is actionable
|
READY Matches if the task is actionable
|
||||||
SCHEDULED Matches if the task is scheduled
|
SCHEDULED Matches if the task is scheduled
|
||||||
TAGGED Matches if the task has tags
|
TAGGED Matches if the task has tags
|
||||||
|
@ -682,6 +685,7 @@ are:
|
||||||
WEEK Matches if the task is due this week
|
WEEK Matches if the task is due this week
|
||||||
YEAR Matches if the task is due this year
|
YEAR Matches if the task is due this year
|
||||||
YESTERDAY Matches if the task was due sometime yesterday
|
YESTERDAY Matches if the task was due sometime yesterday
|
||||||
|
|
||||||
.\" If you update the above list, update src/commands/CmdInfo.cpp and src/commands/CmdTags.cpp as well.
|
.\" If you update the above list, update src/commands/CmdInfo.cpp and src/commands/CmdTags.cpp as well.
|
||||||
|
|
||||||
You can use +BLOCKED to filter blocked tasks, or -BLOCKED for unblocked tasks.
|
You can use +BLOCKED to filter blocked tasks, or -BLOCKED for unblocked tasks.
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef PRODUCT_TASKWARRIOR
|
#ifdef PRODUCT_TASKWARRIOR
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#endif
|
#endif
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -1170,6 +1171,8 @@ bool Task::hasTag (const std::string& tag) const
|
||||||
// Synthetic tags - dynamically generated, but do not occupy storage space.
|
// Synthetic tags - dynamically generated, but do not occupy storage space.
|
||||||
// Note: This list must match that in CmdInfo::execute.
|
// Note: This list must match that in CmdInfo::execute.
|
||||||
// Note: This list must match that in ::feedback_reserved_tags.
|
// Note: This list must match that in ::feedback_reserved_tags.
|
||||||
|
if (isupper (tag[0]))
|
||||||
|
{
|
||||||
if (tag == "BLOCKED") return is_blocked;
|
if (tag == "BLOCKED") return is_blocked;
|
||||||
if (tag == "UNBLOCKED") return !is_blocked;
|
if (tag == "UNBLOCKED") return !is_blocked;
|
||||||
if (tag == "BLOCKING") return is_blocking;
|
if (tag == "BLOCKING") return is_blocking;
|
||||||
|
@ -1199,6 +1202,9 @@ bool Task::hasTag (const std::string& tag) const
|
||||||
if (tag == "UDA") return is_udaPresent ();
|
if (tag == "UDA") return is_udaPresent ();
|
||||||
if (tag == "ORPHAN") return is_orphanPresent ();
|
if (tag == "ORPHAN") return is_orphanPresent ();
|
||||||
if (tag == "LATEST") return id == context.tdb2.latest_id ();
|
if (tag == "LATEST") return id == context.tdb2.latest_id ();
|
||||||
|
if (tag == "PROJECT") return has ("project");
|
||||||
|
if (tag == "PRIORITY") return has ("priority");
|
||||||
|
}
|
||||||
|
|
||||||
// Concrete tags.
|
// Concrete tags.
|
||||||
std::vector <std::string> tags;
|
std::vector <std::string> tags;
|
||||||
|
|
|
@ -338,6 +338,8 @@ int CmdInfo::execute (std::string& output)
|
||||||
if (task.hasTag ("YEAR")) virtualTags += "YEAR ";
|
if (task.hasTag ("YEAR")) virtualTags += "YEAR ";
|
||||||
if (task.hasTag ("YESTERDAY")) virtualTags += "YESTERDAY ";
|
if (task.hasTag ("YESTERDAY")) virtualTags += "YESTERDAY ";
|
||||||
if (task.hasTag ("LATEST")) virtualTags += "LATEST ";
|
if (task.hasTag ("LATEST")) virtualTags += "LATEST ";
|
||||||
|
if (task.hasTag ("PROJECT")) virtualTags += "PROJECT ";
|
||||||
|
if (task.hasTag ("PRIORITY")) virtualTags += "PRIORITY ";
|
||||||
// If you update the above list, update src/commands/CmdInfo.cpp and src/commands/CmdTags.cpp as well.
|
// If you update the above list, update src/commands/CmdInfo.cpp and src/commands/CmdTags.cpp as well.
|
||||||
|
|
||||||
row = view.addRow ();
|
row = view.addRow ();
|
||||||
|
|
|
@ -357,30 +357,35 @@ void feedback_reserved_tags (const std::string& tag)
|
||||||
{
|
{
|
||||||
// Note: This list must match that in Task::hasTag.
|
// Note: This list must match that in Task::hasTag.
|
||||||
// Note: This list must match that in CmdInfo::execute.
|
// Note: This list must match that in CmdInfo::execute.
|
||||||
if (tag == "BLOCKED" ||
|
if (tag == "ACTIVE" ||
|
||||||
tag == "UNBLOCKED" ||
|
tag == "ANNOTATED" ||
|
||||||
|
tag == "BLOCKED" ||
|
||||||
tag == "BLOCKING" ||
|
tag == "BLOCKING" ||
|
||||||
tag == "READY" ||
|
tag == "CHILD" ||
|
||||||
|
tag == "COMPLETED" ||
|
||||||
|
tag == "DELETED" ||
|
||||||
tag == "DUE" ||
|
tag == "DUE" ||
|
||||||
tag == "DUETODAY" ||
|
tag == "DUETODAY" ||
|
||||||
tag == "TODAY" ||
|
tag == "LATEST" ||
|
||||||
tag == "YESTERDAY" ||
|
|
||||||
tag == "TOMORROW" ||
|
|
||||||
tag == "OVERDUE" ||
|
|
||||||
tag == "WEEK" ||
|
|
||||||
tag == "MONTH" ||
|
tag == "MONTH" ||
|
||||||
tag == "YEAR" ||
|
tag == "ORPHAN" ||
|
||||||
tag == "ACTIVE" ||
|
tag == "OVERDUE" ||
|
||||||
tag == "SCHEDULED" ||
|
|
||||||
tag == "CHILD" ||
|
|
||||||
tag == "UNTIL" ||
|
|
||||||
tag == "ANNOTATED" ||
|
|
||||||
tag == "TAGGED" ||
|
|
||||||
tag == "PARENT" ||
|
tag == "PARENT" ||
|
||||||
tag == "WAITING" ||
|
|
||||||
tag == "PENDING" ||
|
tag == "PENDING" ||
|
||||||
tag == "COMPLETED" ||
|
tag == "PRIORITY" ||
|
||||||
tag == "DELETED")
|
tag == "PROJECT" ||
|
||||||
|
tag == "READY" ||
|
||||||
|
tag == "SCHEDULED" ||
|
||||||
|
tag == "TAGGED" ||
|
||||||
|
tag == "TODAY" ||
|
||||||
|
tag == "TOMORROW" ||
|
||||||
|
tag == "UDA" ||
|
||||||
|
tag == "UNBLOCKED" ||
|
||||||
|
tag == "UNTIL" ||
|
||||||
|
tag == "WAITING" ||
|
||||||
|
tag == "WEEK" ||
|
||||||
|
tag == "YEAR" ||
|
||||||
|
tag == "YESTERDAY")
|
||||||
{
|
{
|
||||||
throw format (STRING_FEEDBACK_TAG_VIRTUAL, tag);
|
throw format (STRING_FEEDBACK_TAG_VIRTUAL, tag);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue