system/scripts/him.sh

40 lines
726 B
Bash
Executable file

#!/bin/bash
bin="himalaya"
case $1 in
"" | "list")
for acc in $(NO_COLOR=1 $bin accounts | grep imap | awk '{ print $1 }')
do
echo "account: $acc"
$bin -a "$acc" list -s 10 -w 120 | grep '✷'
echo "---"
done
;;
"unread-count")
a=0
for acc in $(NO_COLOR=1 $bin accounts | grep imap | awk '{ print $1 }')
do
a=$((a+$($bin -a "$acc" search unseen | grep '✷' | wc -l)))
done
echo $a
;;
"watch")
while true
do
printf '\033[2J'
$0 list
sleep 60
done
;;
"mark-read")
for id in $(NO_COLOR=1 $bin -a $2 search unseen | grep '✷'| awk '{ print $1 }')
do
$bin -a $2 flag add $id seen
done
esac