aboutsummaryrefslogtreecommitdiffstats
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
parent25ba83f0b9af172b355a5b8d3d584ffeaa49a432 (diff)
added basic tw tasks to dayplan
-rwxr-xr-xcalendar/dayplan_revised.pl23
-rw-r--r--tw/task_next_projects.pl22
2 files changed, 43 insertions, 2 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),
diff --git a/tw/task_next_projects.pl b/tw/task_next_projects.pl
index d87d8a4..eaa13f8 100644
--- a/tw/task_next_projects.pl
+++ b/tw/task_next_projects.pl
@@ -21,10 +21,30 @@ sub pending_home {
}
}
+sub sched_today_work {
+ my $tw = qx(task project:w status:pending sched:today export);
+ my $text = $json->decode( $tw );
+ foreach my $h (@{$text}) {
+ printf ("%-16s: %s\n", ${$h}{'project'}, ${$h}{'description'});
+ }
+}
+
+sub due_today_work {
+ my $tw = qx(task project:w status:pending due:today export);
+ my $text = $json->decode( $tw );
+ foreach my $h (@{$text}) {
+ printf ("%-16s: %s\n", ${$h}{'project'}, ${$h}{'description'});
+ }
+}
+
+print "Work Due Today:\n-----\n";
+due_today_work();
+
+print "Work Sched Today:\n-----\n";
+sched_today_work();
print "Work:\n-----\n";
pending_work();
-
print "\nHome:\n-----\n";
pending_home();