diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-09-06 10:29:29 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-09-06 10:29:29 +0200 |
commit | f653f4437e046b49d77a4b70980029c05f133157 (patch) | |
tree | 2dda230f405c58a2de35bd5c9a7c78cc78615aec /todo | |
parent | 94761c1f439ccc5ac9a6ac609873211d6f83f211 (diff) | |
download | bin-f653f4437e046b49d77a4b70980029c05f133157.tar.gz bin-f653f4437e046b49d77a4b70980029c05f133157.tar.xz |
Add todo
Original source:
https://bitbucket.org/jasonwryan/centurion/src/tip/Scripts/todo
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'todo')
-rw-r--r-- | todo | 56 |
1 files changed, 56 insertions, 0 deletions
@@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# email reminder notes using at(1)... + +usage() { + cat <<EOF + Options: + -c | create job + -l | list current jobs + -p n | print details for job n + -h | print this message + +EOF +} + +alist() { + atq | sort -r -k3M -k4 +} + +aprint() { + awk -F\" '/gmail/ { print $2 }' <(at -c "$@") +} + +aread() { + read -p "Time of message? [HH:MM] " attime + read -p "Date of message? [DD.MM.YY] " atdate + read -p "Message body? " message + + timexp='^[0-9]{2}:[0-9]{2}' + datexp='^[0-9]{2}.[0-9]{2}.[0-9]{2}' + + if [[ $attime =~ $timexp && $atdate =~ $datexp ]]; then + at "$attime" "$atdate" << EOF + printf '%s\n' "$message" | mutt -s "REMINDER" jasonwryan@gmail.com +EOF + else + printf '%s\n' "Incorrectly formatted values, bailing..." && exit 1 + fi +} + +if (( $# >= 1 )); then + case "$1" in + -c) aread + ;; + -p) aprint "$2" + ;; + -l) alist + ;; + -h) usage + ;; + *) usage && exit 1 + ;; + esac +else usage && exit 1 +fi + +# vim:set ts=2 sts=2 sw=2 et: |