mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-27 12:16:25 +02:00
CmdTrack: Filter now created from CLI in helper
This commit is contained in:
parent
9a362fd510
commit
039f49c2e6
1 changed files with 5 additions and 35 deletions
|
@ -35,44 +35,14 @@ int CmdTrack (
|
||||||
Rules& rules,
|
Rules& rules,
|
||||||
Database& database)
|
Database& database)
|
||||||
{
|
{
|
||||||
// TODO Parse interval.
|
// Set up a filter based on the command line.
|
||||||
// TODO Parse tags.
|
auto filter = initializeFilterFromCLI (cli);
|
||||||
std::string start {""};
|
|
||||||
std::string end {""};
|
|
||||||
std::vector <std::string> tags;
|
|
||||||
for (auto& arg : cli._args)
|
|
||||||
{
|
|
||||||
if (arg.hasTag ("BINARY") ||
|
|
||||||
arg.hasTag ("CMD"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (arg.hasTag ("HINT"))
|
|
||||||
{
|
|
||||||
expandIntervalHint (arg.attribute ("canonical"), start, end);
|
|
||||||
}
|
|
||||||
else if (arg._lextype == Lexer::Type::date)
|
|
||||||
{
|
|
||||||
if (start == "")
|
|
||||||
start = arg.attribute ("raw");
|
|
||||||
else if (end == "")
|
|
||||||
end = arg.attribute ("raw");
|
|
||||||
|
|
||||||
// TODO Is this workable? Using excess date fields as tags. Might just
|
|
||||||
// be a coincidence.
|
|
||||||
else
|
|
||||||
tags.push_back (arg.attribute ("raw"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tags.push_back (arg.attribute ("raw"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Add new interval.
|
// TODO Add new interval.
|
||||||
Interval tracked;
|
Interval tracked;
|
||||||
tracked.start (Datetime (start));
|
tracked.start (filter.start ());
|
||||||
tracked.end (Datetime (end));
|
tracked.end (filter.end ());
|
||||||
for (auto& tag : tags)
|
for (auto& tag : filter.tags ())
|
||||||
tracked.tag (tag);
|
tracked.tag (tag);
|
||||||
|
|
||||||
// TODO Apply exclusions.
|
// TODO Apply exclusions.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue