#!/usr/bin/env bash # # A wrapper for all email tasks. Examples: 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 } function tag { afew -tnv afew -mnv echo "re-tagging inbox.." afew -t tag:inbox } 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 ;; "sync") ssh dev.simatime.com eml all muchsync -vv dev.simatime.com ;; "-h"|"--help") echo "usage: $(basename $0) [in|out|new|tag|all|sync]" exit 1 ;; *) count ;; esac