diff options
Diffstat (limited to 'aerc2task.pl')
-rwxr-xr-x | aerc2task.pl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/aerc2task.pl b/aerc2task.pl new file mode 100755 index 0000000..76fbe2f --- /dev/null +++ b/aerc2task.pl @@ -0,0 +1,17 @@ +#!/usr/bin/env perl + +# this script is used to pipe an email from aerc using pipe -m ./aerc2task.pl to taskwarrior + +foreach my $line (<STDIN>) { + chomp; + if ($line =~ /^Subject/) { + print "Received: $line\n"; + my @task_split = split(/Subject: /, $line); + $task = @task_split[1]; + $task =~ s/TASK//g; + $task =~ s/WATCH//g; + print "So task is: $task\n"; + system("task add $task") == 0 or die "Calling taskwarrrior failed: $?"; + } +} + |