diff options
author | Ben Sima <ben@bsima.me> | 2019-05-13 13:49:54 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2019-05-13 13:51:02 -0700 |
commit | 78971e60fa76e7717384df9965a8232d39a76501 (patch) | |
tree | 6acf33549bc372859b9793c791340eff18b32fc3 /eml | |
parent | 9984ec59f0d8784410316e54ea230b234e7b9ed8 (diff) |
more flexible eml script
Diffstat (limited to 'eml')
-rwxr-xr-x | eml | 49 |
1 files changed, 41 insertions, 8 deletions
@@ -1,12 +1,45 @@ #!/usr/bin/env bash +# +# A wrapper for all email tasks. Examples: -count=$(notmuch count tag:inbox and tag:unread) +function count { + count=$(notmuch count tag:inbox and tag:unread) + if [[ $count > 0 ]]; then + notify-send "New mail" "$count messages" + else + notify-send "No new mail" + fi + echo $count +} -if [[ $count > 0 ]]; then - notify-send "New mail" "$count messages" -else - notify-send "No new mail" -fi +function tag { + afew -tnv + afew -mnv + echo "re-tagging inbox.." + afew -t tag:inbox +} -echo $count -exit 0; +case "$1" in + "in") mbsync --all + ;; + "out") msmtp-queue -r + ;; + "new") notmuch new + ;; + "tag") tag + ;; + "all") + notify-send "Starting email sync" + msmtp-queue -r + mbsync --all + notmuch new + tag + count + ;; + "help") + echo "usage: $0 [in | out | tag]" + exit 1 + ;; + *) count + ;; +esac |