mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
dom: Added 'dom.tag.count' support
This commit is contained in:
parent
3fd2020ab0
commit
3b789629d7
1 changed files with 25 additions and 0 deletions
25
src/dom.cpp
25
src/dom.cpp
|
@ -94,6 +94,31 @@ bool domGet (
|
||||||
|
|
||||||
pig.restore ();
|
pig.restore ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (pig.skipLiteral ("tag."))
|
||||||
|
{
|
||||||
|
// Generate a unique, ordered list of tags.
|
||||||
|
std::set <std::string> tags;
|
||||||
|
for (auto& line : database.allLines ())
|
||||||
|
{
|
||||||
|
if (line[0] == 'i')
|
||||||
|
{
|
||||||
|
Interval interval;
|
||||||
|
interval.initialize (line);
|
||||||
|
|
||||||
|
for (auto& tag : interval.tags ())
|
||||||
|
tags.insert (tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dom.tag.count
|
||||||
|
if (pig.skipLiteral ("count"))
|
||||||
|
{
|
||||||
|
value = format ("{1}", tags.size ());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue