From 20611ed9c62a0aa86d156bd98ce83c03223c7a2f Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Wed, 11 May 2022 18:23:12 +0300 Subject: [PATCH] refac(nix/prog/himalaya): improve mark-read action --- nix/progs/himalaya.nix | 4 ++-- scripts/him.sh | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/nix/progs/himalaya.nix b/nix/progs/himalaya.nix index 8680e86..6d43c53 100644 --- a/nix/progs/himalaya.nix +++ b/nix/progs/himalaya.nix @@ -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"; }; }; diff --git a/scripts/him.sh b/scripts/him.sh index 04fba48..04c523a 100755 --- a/scripts/him.sh +++ b/scripts/him.sh @@ -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