mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
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:
parent
69fc2c3be8
commit
ded55c360b
5 changed files with 21 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue