diff --git a/scripts/add-ons/export-csv.pl b/scripts/add-ons/export-csv.pl
index f8c6e0929..251cc7ad1 100755
--- a/scripts/add-ons/export-csv.pl
+++ b/scripts/add-ons/export-csv.pl
@@ -37,12 +37,11 @@ if ($@)
exit 1;
}
-
-# Use the taskwarrior 1.9.4+ _query command to issue a query and return JSON
-my $command = '/usr/local/bin/task _query ' . join (' ', @ARGV);
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+my $command = join (' ', ("env PATH=$ENV{PATH} task export", @ARGV));
if ($command =~ /No matches/)
{
- print stderr $command;
+ printf STDERR $command;
exit 1;
}
diff --git a/scripts/add-ons/export-html.pl b/scripts/add-ons/export-html.pl
index 29faf68fe..1d2b4fbd6 100755
--- a/scripts/add-ons/export-html.pl
+++ b/scripts/add-ons/export-html.pl
@@ -37,12 +37,11 @@ if ($@)
exit 1;
}
-
-# Use the taskwarrior 1.9.4+ _query command to issue a query and return JSON
-my $command = '/usr/local/bin/task _query ' . join (' ', @ARGV);
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+my $command = join (' ', ("env PATH=$ENV{PATH} task export", @ARGV));
if ($command =~ /No matches/)
{
- print stderr $command;
+ printf STDERR $command;
exit 1;
}
diff --git a/scripts/add-ons/export-ical.pl b/scripts/add-ons/export-ical.pl
index 29ad49ec7..7ec91fb97 100755
--- a/scripts/add-ons/export-ical.pl
+++ b/scripts/add-ons/export-ical.pl
@@ -37,12 +37,11 @@ if ($@)
exit 1;
}
-
-# Use the taskwarrior 1.9.4+ _query command to issue a query and return JSON
-my $command = '/usr/local/bin/task _query ' . join (' ', @ARGV);
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+my $command = join (' ', ("env PATH=$ENV{PATH} task export", @ARGV));
if ($command =~ /No matches/)
{
- print stderr $command;
+ printf STDERR $command;
exit 1;
}
diff --git a/scripts/add-ons/export-xml.pl b/scripts/add-ons/export-xml.pl
index 641637c28..861c604f8 100755
--- a/scripts/add-ons/export-xml.pl
+++ b/scripts/add-ons/export-xml.pl
@@ -37,12 +37,11 @@ if ($@)
exit 1;
}
-
-# Use the taskwarrior 1.9.4+ _query command to issue a query and return JSON
-my $command = '/usr/local/bin/task _query ' . join (' ', @ARGV);
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+my $command = join (' ', ("env PATH=$ENV{PATH} task export", @ARGV));
if ($command =~ /No matches/)
{
- print stderr $command;
+ printf STDERR $command;
exit 1;
}
diff --git a/scripts/add-ons/export-xml.py b/scripts/add-ons/export-xml.py
index 00be9d0b3..d2b967fd1 100755
--- a/scripts/add-ons/export-xml.py
+++ b/scripts/add-ons/export-xml.py
@@ -30,32 +30,32 @@ import sys
import commands
import json
-# Use the taskwarrior 1.9.4+ _query command to issue a query and return JSON
-command = "/usr/local/bin/task _query " + " ".join (sys.argv[1:])
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+command = "/usr/local/bin/task export " + " ".join (sys.argv[1:])
# Generate output.
print ""
for task in commands.getoutput (command).split (",\n"):
data = json.loads (task)
- print (" ")
+ print " "
for name,value in data.items ():
if name == "annotations":
- print (" ")
+ print " "
for anno in value:
- print (" ")
+ print " "
for name,value in anno.items ():
- print (" <{0}>{1}{0}>".format (name, value))
- print (" ")
- print (" ")
+ print " <{0}>{1}{0}>".format (name, value)
+ print " "
+ print " "
elif name == "tags":
- print (" ")
+ print " "
for tag in value:
- print (" {0}".format (tag))
- print (" ")
+ print " {0}".format (tag)
+ print " "
else:
- print (" <{0}>{1}{0}>".format (name, value))
- print (" ")
-print ("")
+ print " <{0}>{1}{0}>".format (name, value)
+ print " "
+print ""
sys.exit (0)
################################################################################
diff --git a/scripts/add-ons/export-xml.rb b/scripts/add-ons/export-xml.rb
index f3b3a2191..920a025fd 100755
--- a/scripts/add-ons/export-xml.rb
+++ b/scripts/add-ons/export-xml.rb
@@ -29,8 +29,8 @@
require 'rubygems'
require 'json'
-# Use the taskwarrior 1.9.4+ _query command to issue a query and return JSON
-lines = IO.popen("/usr/local/bin/task _query " + ARGV.join(" ")).readlines
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+lines = IO.popen("/usr/local/bin/task export " + ARGV.join(" ")).readlines
# Generate output.
print "\n"
diff --git a/scripts/add-ons/export-yad.pl b/scripts/add-ons/export-yad.pl
new file mode 100755
index 000000000..251cc7ad1
--- /dev/null
+++ b/scripts/add-ons/export-yad.pl
@@ -0,0 +1,82 @@
+#! /usr/bin/perl
+################################################################################
+## taskwarrior - a command line task list manager.
+##
+## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
+## All rights reserved.
+##
+## This program is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free Software
+## Foundation; either version 2 of the License, or (at your option) any later
+## version.
+##
+## This program is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public License along with
+## this program; if not, write to the
+##
+## Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor,
+## Boston, MA
+## 02110-1301
+## USA
+##
+################################################################################
+
+use strict;
+use warnings;
+
+# Give a nice error if the (non-standard) JSON module is not installed.
+eval "use JSON";
+if ($@)
+{
+ print "Error: You need to install the JSON Perl module.\n";
+ exit 1;
+}
+
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+my $command = join (' ', ("env PATH=$ENV{PATH} task export", @ARGV));
+if ($command =~ /No matches/)
+{
+ printf STDERR $command;
+ exit 1;
+}
+
+# Generate output.
+print "'uuid','status','tags','entry','start','due','recur','end','project',",
+ "'priority','fg','bg','description'\n";
+
+for my $task (split /,$/ms, qx{$command})
+{
+ my $data = from_json ($task);
+
+ print "'$data->{'uuid'}',",
+ "'$data->{'status'}',",
+ "'", (exists $data->{'tags'} ? join (' ', @{$data->{'tags'}}) : ''), "',",
+ "'$data->{'entry'}',",
+ "'", ($data->{'start'} || ''), "',",
+ "'", ($data->{'due'} || ''), "',",
+ "'", ($data->{'recur'} || ''), "',",
+ "'", ($data->{'end'} || ''), "',",
+ "'", ($data->{'project'} || ''), "',",
+ "'", ($data->{'priority'} || ''), "',",
+ "'", ($data->{'fg'} || ''), "',",
+ "'", ($data->{'bg'} || ''), "',",
+ "'$data->{'description'}'",
+ "\n";
+
+ # Note that this format ignores:
+ # wait
+ # until
+ # annotations
+ # mask
+ # imask
+}
+
+exit 0;
+
+################################################################################
+
diff --git a/scripts/add-ons/export-yaml.pl b/scripts/add-ons/export-yaml.pl
index 8d965fda2..77d1632d4 100755
--- a/scripts/add-ons/export-yaml.pl
+++ b/scripts/add-ons/export-yaml.pl
@@ -37,12 +37,11 @@ if ($@)
exit 1;
}
-
-# Use the taskwarrior 1.9.4+ _query command to issue a query and return JSON
-my $command = '/usr/local/bin/task _query ' . join (' ', @ARGV);
+# Use the taskwarrior 2.0+ export command to filter and return JSON
+my $command = join (' ', ("env PATH=$ENV{PATH} task export", @ARGV));
if ($command =~ /No matches/)
{
- print stderr $command;
+ printf STDERR $command;
exit 1;
}
@@ -55,7 +54,7 @@ for my $task (split /,$/ms, qx{$command})
my $data = from_json ($task);
print " task:\n";
- for my $key (keys %$data)
+ for my $key (sort keys %$data)
{
if ($key eq 'annotations')
{
@@ -63,17 +62,16 @@ for my $task (split /,$/ms, qx{$command})
for my $anno (@{$data->{$key}})
{
print " annotation:\n";
- print " $_:$anno->{$_}\n" for keys %$anno;
+ print " $_: $anno->{$_}\n" for keys %$anno;
}
}
elsif ($key eq 'tags')
{
- print " tags:\n";
- print " tag:$_\n" for @{$data->{'tags'}};
+ print " tags: ", join (',', @{$data->{'tags'}}), "\n";
}
else
{
- print " $key:$data->{$key}\n";
+ print " $key: $data->{$key}\n";
}
}
}