Commands - _query

- Migrated handleQuery to CmdQuery.
This commit is contained in:
Paul Beckingham
2011-05-30 13:00:51 -04:00
parent 75e651626d
commit 4603bdb509
8 changed files with 129 additions and 44 deletions

View File

@@ -51,45 +51,6 @@
extern Context context;
////////////////////////////////////////////////////////////////////////////////
int handleQuery (std::string& outs)
{
int rc = 0;
// Get all the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));
handleRecurrence ();
context.tdb.load (tasks, context.filter);
context.tdb.commit ();
context.tdb.unlock ();
// Filter sequence.
if (context.sequence.size ())
context.filter.applySequence (tasks, context.sequence);
if (tasks.size () == 0)
{
std::cout << "No matches.\n";
return 1;
}
// Note: "limit:" feature not supported.
// Compose output.
std::vector <Task>::iterator t;
for (t = tasks.begin (); t != tasks.end (); ++t)
{
if (t != tasks.begin ())
outs += ",\n";
outs += t->composeJSON (true);
}
outs += "\n";
return rc;
}
////////////////////////////////////////////////////////////////////////////////
void handleUndo ()
{