mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Virtual Tag: Undocumented, experimental support for 'LATEST'
This commit is contained in:
parent
86dc14823e
commit
ada6c24789
4 changed files with 12 additions and 2 deletions
|
@ -1287,6 +1287,13 @@ int TDB2::next_id ()
|
|||
return _id++;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Latest ID is that of the last pending task.
|
||||
int TDB2::latest_id ()
|
||||
{
|
||||
return _id - 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::vector <Task> TDB2::all_tasks ()
|
||||
{
|
||||
|
|
|
@ -107,6 +107,7 @@ public:
|
|||
void revert ();
|
||||
int gc ();
|
||||
int next_id ();
|
||||
int latest_id ();
|
||||
|
||||
// Generalized task accessors.
|
||||
const std::vector <Task> all_tasks ();
|
||||
|
|
|
@ -1196,8 +1196,9 @@ bool Task::hasTag (const std::string& tag) const
|
|||
if (tag == "PENDING") return get ("status") == "pending";
|
||||
if (tag == "COMPLETED") return get ("status") == "completed";
|
||||
if (tag == "DELETED") return get ("status") == "deleted";
|
||||
if (tag == "UDA") return is_udaPresent();
|
||||
if (tag == "ORPHAN") return is_orphanPresent();
|
||||
if (tag == "UDA") return is_udaPresent ();
|
||||
if (tag == "ORPHAN") return is_orphanPresent ();
|
||||
if (tag == "LATEST") return id == context.tdb2.latest_id ();
|
||||
|
||||
// Concrete tags.
|
||||
std::vector <std::string> tags;
|
||||
|
|
|
@ -337,6 +337,7 @@ int CmdInfo::execute (std::string& output)
|
|||
if (task.hasTag ("WEEK")) virtualTags += "WEEK ";
|
||||
if (task.hasTag ("YEAR")) virtualTags += "YEAR ";
|
||||
if (task.hasTag ("YESTERDAY")) virtualTags += "YESTERDAY ";
|
||||
if (task.hasTag ("LATEST")) virtualTags += "LATEST ";
|
||||
// If you update the above list, update src/commands/CmdInfo.cpp and src/commands/CmdTags.cpp as well.
|
||||
|
||||
row = view.addRow ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue