mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-25 12:17:20 +02:00
Config: Make json.array default to "on"
- This makes the default "export" output work out of the box with most JSON parsing libraries.
This commit is contained in:
parent
e516f2bf65
commit
c1a0370daa
6 changed files with 14 additions and 7 deletions
|
@ -25,6 +25,8 @@
|
||||||
- Enable "task sync" support by default. "cmake -DENABLE_SYNC=OFF" allows
|
- Enable "task sync" support by default. "cmake -DENABLE_SYNC=OFF" allows
|
||||||
disabling it and building Taskwarrior without libgnutls available.
|
disabling it and building Taskwarrior without libgnutls available.
|
||||||
- An attempt to add or remove a virtual tag is now an error (thanks to Scott M).
|
- An attempt to add or remove a virtual tag is now an error (thanks to Scott M).
|
||||||
|
- json.array now defaults to "on", making "export" output a JSON array that
|
||||||
|
can be parsed by most JSON libraries without changes.
|
||||||
|
|
||||||
------ current release ---------------------------
|
------ current release ---------------------------
|
||||||
|
|
||||||
|
|
|
@ -394,9 +394,12 @@ Enables or disables access to Taskwarrior internals and task metadata on the
|
||||||
command line. Defaults to on.
|
command line. Defaults to on.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B json.array=off
|
.B json.array=on
|
||||||
Determines whether the query command encloses the JSON output in '[...]' to
|
Determines whether the export command encloses the JSON output in '[...]' and
|
||||||
create a properly-formed JSON array. Defaults to off.
|
adds ',' after each exported task object to create a properly-formed JSON
|
||||||
|
array.
|
||||||
|
With json.array=off, export writes raw JSON objects to STDOUT, one per line.
|
||||||
|
Defaults to on.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B _forcecolor=no
|
.B _forcecolor=no
|
||||||
|
|
|
@ -106,7 +106,7 @@ std::string Config::_defaults =
|
||||||
"xterm.title=no # Sets xterm title for some commands\n"
|
"xterm.title=no # Sets xterm title for some commands\n"
|
||||||
"expressions=infix # Prefer infix over postfix expressions\n"
|
"expressions=infix # Prefer infix over postfix expressions\n"
|
||||||
"dom=on # Support DOM access\n"
|
"dom=on # Support DOM access\n"
|
||||||
"json.array=off # Enclose JSON output in [ ]\n"
|
"json.array=on # Enclose JSON output in [ ]\n"
|
||||||
"abbreviation.minimum=2 # Shortest allowed abbreviation\n"
|
"abbreviation.minimum=2 # Shortest allowed abbreviation\n"
|
||||||
"\n"
|
"\n"
|
||||||
"# Dates\n"
|
"# Dates\n"
|
||||||
|
|
|
@ -48,7 +48,7 @@ class TestExportCommand(TestCase):
|
||||||
self.t(('add', 'test'))
|
self.t(('add', 'test'))
|
||||||
|
|
||||||
def export(self, identifier):
|
def export(self, identifier):
|
||||||
return json.loads(self.t((str(identifier), 'export'))[1].strip())
|
return json.loads(self.t((str(identifier), 'rc.json.array=off', 'export'))[1].strip())
|
||||||
|
|
||||||
def assertType(self, value, type):
|
def assertType(self, value, type):
|
||||||
self.assertEqual(isinstance(value, type), True)
|
self.assertEqual(isinstance(value, type), True)
|
||||||
|
|
|
@ -44,7 +44,8 @@ $source_dir =~ s{[^/]+$}{..};
|
||||||
if (open my $fh, '>', $rc)
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"verbose=no\n";
|
"verbose=no\n",
|
||||||
|
"json.array=off";
|
||||||
close $fh;
|
close $fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ if (open my $fh, '>', $rc)
|
||||||
"verbose=off\n",
|
"verbose=off\n",
|
||||||
"confirmation=no\n",
|
"confirmation=no\n",
|
||||||
"defaultwidth=100\n",
|
"defaultwidth=100\n",
|
||||||
"dateformat=m/d/Y\n";
|
"dateformat=m/d/Y\n",
|
||||||
|
"json.array=off";
|
||||||
close $fh;
|
close $fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue