From 78971e60fa76e7717384df9965a8232d39a76501 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 13 May 2019 13:49:54 -0700 Subject: more flexible eml script --- eml | 49 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/eml b/eml index 0eb3add..80add9f 100755 --- a/eml +++ b/eml @@ -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 -- cgit v1.2.3