mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Expressions
- Broke out expression handling into two distinct flavors: filter and expression. Filters need lots of preparation and mapping, which includes implicit 'AND' operators, expansion of syntactic sugar like /pattern/ etc and evaluate to a Boolean. Expressions are simpler wiht less preparation, and evaluate to a Variant.
This commit is contained in:
parent
d66729adf3
commit
e08d840ba1
6 changed files with 150 additions and 85 deletions
|
@ -69,8 +69,9 @@ int CmdAdd::execute (std::string& output)
|
|||
if (context.verbose ("new-id"))
|
||||
output = format (STRING_CMD_ADD_FEEDBACK, context.tdb.nextId ()) + "\n";
|
||||
*/
|
||||
|
||||
/*
|
||||
context.footnote (onProjectChange (task));
|
||||
*/
|
||||
context.tdb2.commit ();
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,9 @@ int CmdLog::execute (std::string& output)
|
|||
task.validate ();
|
||||
context.tdb2.add (task);
|
||||
|
||||
/*
|
||||
context.footnote (onProjectChange (task));
|
||||
*/
|
||||
context.tdb2.commit ();
|
||||
|
||||
if (context.config.getBoolean ("echo.command"))
|
||||
|
|
|
@ -279,7 +279,7 @@ void Command::filter (std::vector <Task>& input, std::vector <Task>& output)
|
|||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = input.begin (); task != input.end (); ++task)
|
||||
if (e.eval (*task))
|
||||
if (e.evalFilter (*task))
|
||||
output.push_back (*task);
|
||||
}
|
||||
else
|
||||
|
@ -306,14 +306,14 @@ void Command::filter (std::vector <Task>& output)
|
|||
output.clear ();
|
||||
std::vector <Task>::const_iterator task;
|
||||
for (task = pending.begin (); task != pending.end (); ++task)
|
||||
if (e.eval (*task))
|
||||
if (e.evalFilter (*task))
|
||||
output.push_back (*task);
|
||||
|
||||
if (! filter_shortcut (f))
|
||||
{
|
||||
const std::vector <Task>& completed = context.tdb2.completed.get_tasks (); // TODO Optional
|
||||
for (task = completed.begin (); task != completed.end (); ++task)
|
||||
if (e.eval (*task))
|
||||
if (e.evalFilter (*task))
|
||||
output.push_back (*task);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue