This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# mutt_to_taskpaper.sh | |
# larryhynes.net/ | |
# Important disclaimer: I have no idea what I'm doing | |
# This script will take the subject line of an email in mutt and add it to your Taskpaper inbox provided that "Inbox:" is the first line of your taskpaper file. The script can be called by a macro in mutt by adding `macro index T "<pipe-entry>~/mutt_to_taskpaper.sh<enter>"` to your .muttrc file, then T will add the todo item. You may need to make sure that the script is executable. You can adjust the path and name of your taskpaper file below to suit your setup. | |
TODOFILE=/Users/larry/todo.taskpaper | |
TEMPTODO=$(basename "$0") | |
LINE=1 | |
TMPFILE=$(mktemp /tmp/"${TEMPTODO}".XXXXXX) || exit 1 | |
grep '^Subject:' | awk -F '^Subject:' '{print $2;exit;}' | sed 's/^/ - Email:/' | unexpand -t4 > "$TMPFILE" || exit 1 | |
ed -s $TODOFILE <<SHAZAM | |
${LINE}r $TMPFILE | |
w | |
SHAZAM | |
rm -f "$TMPFILE" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment