summaryrefslogtreecommitdiff
path: root/bin/readmail
diff options
context:
space:
mode:
Diffstat (limited to 'bin/readmail')
-rwxr-xr-xbin/readmail37
1 files changed, 37 insertions, 0 deletions
diff --git a/bin/readmail b/bin/readmail
new file mode 100755
index 0000000..5466088
--- /dev/null
+++ b/bin/readmail
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+dir=~/mail/"${1:-INBOX}"
+
+while true; do
+ mlist "$dir" | msort -dr | mseq -S | MBLAZE_PAGER=cat mscan
+ read -r addr cmd || break
+ if [ -z "$cmd" ]; then
+ cmd="$addr"
+ addr=.
+ fi
+ case "$cmd" in
+ g) mbsync primary && minc ~/mail/* >/dev/null ;;
+ C) mseq -C "$addr" ;;
+ c*) dir=~/mail/"${cmd#c}" ;;
+ s) mshow "$addr" && mflag -S "$addr" >/dev/null ;;
+ a) mrefile "$addr" ~/mail/Archive ;;
+ m*) mrefile "$addr" ~/mail/"${cmd#m}" ;;
+ f*) mflag -"${cmd#f}" "$addr" >/dev/null ;;
+ h)
+ echo 'Commands:'
+ echo 'g - fetch mail'
+ echo 'C - set the sequence to messages'
+ echo 'cFOLDER - cd to FOLDER'
+ echo 's - show messages'
+ echo 'a - archive messages'
+ echo 'mFOLDER - move messages to FOLDER'
+ echo 'fFLAGS - set FLAGS on messages. Uppercase sets, lowercase unsets.'
+ echo ' d=draft, f=flagged, p=passed, r=replied, s=seen, t=trashed.'
+ echo 'h - print this message'
+ echo
+ ;;
+ q) break ;;
+ esac
+done
+echo 'Syncing changes...'
+mbsync primary