summaryrefslogtreecommitdiff
path: root/eml
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-05-13 13:49:54 -0700
committerBen Sima <ben@bsima.me>2019-05-13 13:51:02 -0700
commit78971e60fa76e7717384df9965a8232d39a76501 (patch)
tree6acf33549bc372859b9793c791340eff18b32fc3 /eml
parent9984ec59f0d8784410316e54ea230b234e7b9ed8 (diff)
more flexible eml script
Diffstat (limited to 'eml')
-rwxr-xr-xeml49
1 files 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