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
|
@ -34,6 +34,8 @@
|
|||
be verbose about. See taskrc(5).
|
||||
+ New 'execute' command that runs external programs.
|
||||
+ The default export format is now JSON.
|
||||
+ The configuration variable 'json.array' determines whether 'query' command
|
||||
output is enclosed by '[...]'.
|
||||
|
||||
# Tracked Features, sorted by ID.
|
||||
+ Added feature #330, which supports the 'inverse' color attribute.
|
||||
|
|
4
NEWS
4
NEWS
|
@ -43,6 +43,10 @@ New configuration options in taskwarrior 2.0.0
|
|||
- New 'color.label' for report column labels.
|
||||
- New 'verbose=...' support for individual verbosity settings.
|
||||
- New 'avoidlastcolumn' support for Cygwin users.
|
||||
- New 'patterns' enables/disables command line pattern support.
|
||||
- New 'expressions' enables/disables command line expression support.
|
||||
- New 'json.array' determines whether 'query' command output is enclosed by
|
||||
'[...]'.
|
||||
|
||||
Newly deprecated features in taskwarrior 2.0.0
|
||||
|
||||
|
|
|
@ -309,6 +309,11 @@ Defaults to on.
|
|||
Enables or disables algebraic expression support on the command line, such as
|
||||
"due<eom and (pri=H or pri=M)". Defaults to on.
|
||||
|
||||
.TP
|
||||
.B json.array=off
|
||||
Determines whether the query command encloses the JSON output in '[...]' to
|
||||
create a properly-formed JSON array. Defaults to off.
|
||||
|
||||
.TP
|
||||
.B _forcecolor=no
|
||||
Taskwarrior shuts off color automatically when the output is not sent directly
|
||||
|
|
|
@ -97,6 +97,7 @@ std::string Config::defaults =
|
|||
"xterm.title=no # Sets xterm title for some commands\n"
|
||||
"expressions=on # Support for algebraic expressions\n"
|
||||
"patterns=on # Support for regex patterns\n"
|
||||
"json.array=off # Enclose JSON output in [ ]\n"
|
||||
"\n"
|
||||
"# Dates\n"
|
||||
"dateformat=m/d/Y # Preferred input and display date format\n"
|
||||
|
|
|
@ -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