aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcalendar/dayplan_revised.pl18
1 files changed, 13 insertions, 5 deletions
diff --git a/calendar/dayplan_revised.pl b/calendar/dayplan_revised.pl
index 96eeca0..43e74a7 100755
--- a/calendar/dayplan_revised.pl
+++ b/calendar/dayplan_revised.pl
@@ -96,16 +96,24 @@ sub schoolblock {
sub twblock {
my ($y, $m, $d, $project, $type) = @_;
$m = sprintf("%02d", $m);
+ $d = sprintf("%02d", $d);
my $json = JSON->new->allow_nonref;
my $tw= qx(task project:$project status:pending $type:$y-$m-$d export);
- my $text = $json->decode( $tw );
my @output;
push @output, "## Taskwarrior $type - $project:\n";
- foreach my $h (@{$text}) {
- push @output, sprintf ("* %-16s: %s\n", ${$h}{'project'}, ${$h}{'description'});
+ if ($tw eq "") {
+ push @output, "* No tasks";
+ push @output, "\n";
+ return @output;
+ } else
+ {
+ my $text = $json->decode( $tw );
+ foreach my $h (@{$text}) {
+ push @output, sprintf ("* %-16s: %s\n", ${$h}{'project'}, ${$h}{'description'});
+ }
+ push @output, "\n";
+ return @output;
}
- push @output, "\n";
- return @output;
}
sub remindersblock {