2022-04-24 21:42:11 +03:00
|
|
|
#!/bin/bash
|
2022-05-11 18:23:12 +03:00
|
|
|
|
|
|
|
bin=~/repos/himalaya/target/release/himalaya
|
2022-04-24 21:42:11 +03:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
"" | "list")
|
2022-05-11 18:23:12 +03:00
|
|
|
for acc in $(NO_COLOR=1 $bin accounts | grep imap | awk '{ print $1 }')
|
2022-04-24 21:42:11 +03:00
|
|
|
do
|
|
|
|
echo "account: $acc"
|
2022-05-11 18:23:12 +03:00
|
|
|
$bin -a "$acc" list -s 10 -w 120 | grep '✷'
|
2022-04-24 21:42:11 +03:00
|
|
|
echo "---"
|
|
|
|
done
|
|
|
|
;;
|
2022-04-25 09:57:09 +03:00
|
|
|
|
2022-04-25 22:54:05 +03:00
|
|
|
"unread-count")
|
|
|
|
a=0
|
2022-05-11 18:23:12 +03:00
|
|
|
for acc in $(NO_COLOR=1 $bin accounts | grep imap | awk '{ print $1 }')
|
2022-04-25 22:54:05 +03:00
|
|
|
do
|
2022-05-11 18:23:12 +03:00
|
|
|
a=$((a+$($bin -a "$acc" list | grep '✷' | wc -l)))
|
2022-04-25 22:54:05 +03:00
|
|
|
done
|
|
|
|
echo $a
|
|
|
|
;;
|
|
|
|
|
2022-04-25 09:57:09 +03:00
|
|
|
"watch")
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
printf '\033[2J'
|
|
|
|
$0 list
|
2022-04-25 22:54:05 +03:00
|
|
|
sleep 60
|
2022-04-25 09:57:09 +03:00
|
|
|
done
|
|
|
|
;;
|
2022-04-26 12:16:55 +03:00
|
|
|
|
|
|
|
"mark-read")
|
2022-05-15 11:28:33 +03:00
|
|
|
for id in $(NO_COLOR=1 $bin -a $2 list -s 20 | grep '✷'| awk '{ print $1 }')
|
2022-04-26 12:16:55 +03:00
|
|
|
do
|
2022-05-11 18:23:12 +03:00
|
|
|
$bin -a $2 flag add $id seen
|
2022-04-26 12:16:55 +03:00
|
|
|
done
|
2022-04-24 21:42:11 +03:00
|
|
|
esac
|
|
|
|
|
|
|
|
|