Export - query

- Output from the query command is now optionally surrounded by [ ... ]
  to make this a syntactically correct JSON document.  This is off by
  default.
- Updated documents.
This commit is contained in:
Paul Beckingham 2011-06-13 18:11:44 -04:00
parent 69fc2c3be8
commit ded55c360b
5 changed files with 21 additions and 0 deletions

View file

@ -75,7 +75,13 @@ int CmdQuery::execute (std::string& output)
// Note: "limit:" feature not supported.
// TODO Why not?
// Is output contained within a JSON array?
bool json_array = context.config.getBoolean ("json.array");
// Compose output.
if (json_array)
output += "[\n";
for (task = filtered.begin (); task != filtered.end (); ++task)
{
if (task != filtered.begin ())
@ -84,6 +90,9 @@ int CmdQuery::execute (std::string& output)
output += task->composeJSON (true);
}
if (json_array)
output += "\n]";
output += "\n";
return rc;
}