system/scripts/him.sh

40 lines
713 B
Bash
Executable file

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