aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2022-09-22 15:02:06 +0100
committerMatthew Lemon <matt@matthewlemon.com>2022-09-22 15:02:06 +0100
commit3e141b675c5c103821462ab97cbdaba56f53ca60 (patch)
tree8296f207b503151ed4df0cf8d1a73d21e3b1c7d4 /calendar
parent25ba83f0b9af172b355a5b8d3d584ffeaa49a432 (diff)
added basic tw tasks to dayplan
Diffstat (limited to 'calendar')
-rwxr-xr-xcalendar/dayplan_revised.pl23
1 files changed, 22 insertions, 1 deletions
diff --git a/calendar/dayplan_revised.pl b/calendar/dayplan_revised.pl
index 4dc4ce6..b0b8609 100755
--- a/calendar/dayplan_revised.pl
+++ b/calendar/dayplan_revised.pl
@@ -4,6 +4,7 @@
use strict;
use warnings;
use DateTime;
+use JSON;
# my $dayplans = '/home/lemon/Notes/journal/day_plans';
my $dayplans = "/tmp";
@@ -74,9 +75,10 @@ sub qnoteblock {
$qnote_block = "No quicknotes today.\n";
} else
{
+ unshift @$quicknotes_ref, "Quicknotes:\n-----------\n";
$qnote_block = "@{$quicknotes_ref}"."from:"."\n"."@{$qfiles_ref}";
}
- return $qnote_block;
+ return $qnote_block;
}
sub schoolblock {
@@ -92,6 +94,21 @@ sub schoolblock {
}
}
+sub twblock {
+ my ($y, $m, $d, $project, $type) = @_;
+ $m = sprintf("%02d", $m);
+ 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-----------------------\n";
+ foreach my $h (@{$text}) {
+ push @output, sprintf ("%-16s: %s\n", ${$h}{'project'}, ${$h}{'description'});
+ }
+ push @output, "\n";
+ return @output;
+}
+
sub remindersblock {
my ($y, $m, $d) = @_;
my $reminders = qx(ssh bobbins remind ~/.reminders $y-$m-$d);
@@ -118,6 +135,10 @@ sub generate_text {
my ($quicknotes_ref, $qfiles_ref) = get_quicknotes_and_quickfiles();
return
headerblock($date, $day, $year, $weekday),
+ twblock($year, $month, $day, "w", "sched"),
+ twblock($year, $month, $day, "h", "sched"),
+ twblock($year, $month, $day, "w", "due"),
+ twblock($year, $month, $day, "h", "due"),
qnoteblock($quicknotes_ref, $qfiles_ref),
remindersblock($year, $month, $day),
schoolblock($day),