mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug - import/export now output JSON as individual objects
* For JSON as array, json.array=1 behaves as before * Tests and add-on scripts used in import tests were updated
This commit is contained in:
parent
b569504139
commit
d49a2614ba
6 changed files with 11 additions and 8 deletions
|
@ -125,7 +125,7 @@ while (my $todo = <>)
|
|||
push @tasks, $json;
|
||||
}
|
||||
|
||||
print "[\n", join (",\n", @tasks), "\n]\n";
|
||||
print "[\n", join ("\n", @tasks), "\n]\n";
|
||||
exit 0;
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -117,7 +117,7 @@ while (my $yaml = <>)
|
|||
}
|
||||
}
|
||||
|
||||
print "[\n", join (",\n", @tasks), "\n]\n";
|
||||
print "[\n", join ("\n", @tasks), "\n]\n";
|
||||
exit 0;
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -71,7 +71,11 @@ int CmdExport::execute (std::string& output)
|
|||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
if (task != filtered.begin ())
|
||||
output += ",\n";
|
||||
{
|
||||
if (json_array)
|
||||
output += ",";
|
||||
output += "\n";
|
||||
}
|
||||
|
||||
output += task->composeJSON (true);
|
||||
|
||||
|
|
|
@ -76,8 +76,7 @@ int CmdImport::execute (std::string& output)
|
|||
{
|
||||
std::string object = trimLeft (
|
||||
trimRight (
|
||||
trimRight (
|
||||
trim (*line), ","),
|
||||
trim (*line),
|
||||
"]"),
|
||||
"[");
|
||||
// Skip blanks. May be caused by the trim calls above.
|
||||
|
|
|
@ -45,8 +45,8 @@ if (open my $fh, '>', 'import.rc')
|
|||
if (open my $fh, '>', 'import.txt')
|
||||
{
|
||||
print $fh <<EOF;
|
||||
{"uuid":"00000000-0000-0000-0000-000000000000","description":"zero","project":"A","status":"pending","entry":"1234567889"},
|
||||
{"uuid":"11111111-1111-1111-1111-111111111111","description":"one","project":"B","status":"pending","entry":"1234567889"},
|
||||
{"uuid":"00000000-0000-0000-0000-000000000000","description":"zero","project":"A","status":"pending","entry":"1234567889"}
|
||||
{"uuid":"11111111-1111-1111-1111-111111111111","description":"one","project":"B","status":"pending","entry":"1234567889"}
|
||||
{"uuid":"22222222-2222-2222-2222-222222222222","description":"two","status":"completed","entry":"1234524689","end":"1234524690"}
|
||||
EOF
|
||||
close $fh;
|
||||
|
|
|
@ -73,7 +73,7 @@ like ($output, qr/"extra":"foo"/, 'UDA orphan exported');
|
|||
if (open my $fh, '>', 'import.txt')
|
||||
{
|
||||
print $fh <<EOF;
|
||||
{"uuid":"00000000-0000-0000-0000-000000000000","description":"two","status":"pending","entry":"1234567889","extra":"bar"},
|
||||
{"uuid":"00000000-0000-0000-0000-000000000000","description":"two","status":"pending","entry":"1234567889","extra":"bar"}
|
||||
EOF
|
||||
|
||||
close $fh;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue