refac(nix/prog/himalaya): improve mark-read action

This commit is contained in:
Dmitriy Pleshevskiy 2022-05-11 18:23:12 +03:00
parent a3b91d1222
commit 20611ed9c6
2 changed files with 10 additions and 9 deletions

View file

@ -4,7 +4,7 @@ with lib;
let
cfg = config.progs.himalaya;
bin = "${pkgs.himalaya}/bin/himalaya";
bin = "~/repos/himalaya/target/release/himalaya";
in
{
options.progs.himalaya = {
@ -19,7 +19,7 @@ in
programs.himalaya = {
enable = true;
settings = {
default-page-size = 10;
default-page-size = 20;
downloads-dir = "${config.home.homeDirectory}/downloads/email";
};
};

View file

@ -1,21 +1,22 @@
#!/bin/bash
bin=~/repos/himalaya/target/release
bin=~/repos/himalaya/target/release/himalaya
case $1 in
"" | "list")
for acc in $(NO_COLOR=1 $bin/himalaya accounts | grep imap | awk '{ print $1 }')
for acc in $(NO_COLOR=1 $bin accounts | grep imap | awk '{ print $1 }')
do
echo "account: $acc"
$bin/himalaya -a "$acc" list -w 120 | grep '✷'
$bin -a "$acc" list -s 10 -w 120 | grep '✷'
echo "---"
done
;;
"unread-count")
a=0
for acc in $(NO_COLOR=1 $bin/himalaya accounts | grep imap | awk '{ print $1 }')
for acc in $(NO_COLOR=1 $bin accounts | grep imap | awk '{ print $1 }')
do
a=$((a+$($bin/himalaya -a "$acc" list | grep '✷' | wc -l)))
a=$((a+$($bin -a "$acc" list | grep '✷' | wc -l)))
done
echo $a
;;
@ -30,9 +31,9 @@ case $1 in
;;
"mark-read")
for id in "${@:3}"
for id in $(NO_COLOR=1 $bin list -s 20 | grep '✷'| awk '{ print $1 }')
do
$bin/himalaya -a $2 flag add $id seen
$bin -a $2 flag add $id seen
done
esac