summaryrefslogtreecommitdiff
path: root/eml
blob: 2f034ebfeeac56a3b91b2d534311aa48b1eb9e24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/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