aboutsummaryrefslogblamecommitdiffstats
path: root/aerc2task.pl
blob: 76fbe2f1b8e43c07d9e5e8e81f0760b1517c8717 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
                   











                                                                                            
                                                                               


     
#!/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: $?";
    }
}