Expressions

- Re-enabled read-only commands that were broken because expressions
  were not implemented.  Currently they don't work, but the mechanism
  is in place.
This commit is contained in:
Paul Beckingham 2011-06-11 14:30:19 -04:00
parent ad75ba49a4
commit 63e6c08fdd
10 changed files with 271 additions and 155 deletions

View file

@ -28,6 +28,7 @@
#include <sstream>
#include <stdlib.h>
#include <Context.h>
#include <Expression.h>
#include <main.h>
#include <CmdUrgency.h>
@ -46,18 +47,27 @@ CmdUrgency::CmdUrgency ()
////////////////////////////////////////////////////////////////////////////////
int CmdUrgency::execute (std::string& output)
{
/*
// Get all the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));
handleRecurrence ();
context.tdb.loadPending (tasks, context.filter);
Filter filter;
context.tdb.loadPending (tasks, filter);
context.tdb.commit ();
context.tdb.unlock ();
// Filter.
Arguments f = context.args.extract_read_only_filter ();
Expression e (f);
std::vector <Task> filtered;
std::vector <Task>::iterator task;
for (task = tasks.begin (); task != tasks.end (); ++task)
if (e.eval (*task))
filtered.push_back (*task);
// Filter sequence.
context.filter.applySequence (tasks, context.sequence);
if (tasks.size () == 0)
if (filtered.size () == 0)
{
context.footnote ("No tasks specified.");
return 1;
@ -65,8 +75,7 @@ int CmdUrgency::execute (std::string& output)
// Find the task(s).
std::stringstream out;
std::vector <Task>::iterator task;
for (task = tasks.begin (); task != tasks.end (); ++task)
for (task = filtered.begin (); task != filtered.end (); ++task)
out << "task "
<< task->id
<< " urgency "
@ -74,7 +83,6 @@ int CmdUrgency::execute (std::string& output)
<< "\n";
output = out.str ();
*/
return 0;
}