mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 19:17:19 +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++;
|
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 ()
|
const std::vector <Task> TDB2::all_tasks ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,7 @@ public:
|
||||||
void revert ();
|
void revert ();
|
||||||
int gc ();
|
int gc ();
|
||||||
int next_id ();
|
int next_id ();
|
||||||
|
int latest_id ();
|
||||||
|
|
||||||
// Generalized task accessors.
|
// Generalized task accessors.
|
||||||
const std::vector <Task> all_tasks ();
|
const std::vector <Task> all_tasks ();
|
||||||
|
|
|
@ -1198,6 +1198,7 @@ bool Task::hasTag (const std::string& tag) const
|
||||||
if (tag == "DELETED") return get ("status") == "deleted";
|
if (tag == "DELETED") return get ("status") == "deleted";
|
||||||
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 ();
|
||||||
|
|
||||||
// Concrete tags.
|
// Concrete tags.
|
||||||
std::vector <std::string> 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 ("WEEK")) virtualTags += "WEEK ";
|
||||||
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 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 ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue