citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit daca3883c20d07456bc64ba28a10ea07b1a7d4a4
parent 4f0e64a38ecbd7fbaa35b65a3e37eba7eda36e34
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 30 Mar 2021 04:41:19 -0700

reader: support more doc types

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mbin/reader | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/bin/reader b/bin/reader @@ -3,10 +3,15 @@ BOOKS_DIR="${1:-$HOME/docs}" set -eou pipefail -find "$BOOKS_DIR" -name '*.txt' -type f -printf '%T@\t%f\t%p\n' | +document=$(find "$BOOKS_DIR" \( -iname '*.txt' -o -iname '*.epub' -o -iname '*.pdf' -o -iname '*.djvu' \) -type f -printf '%T@\t%f\t%p\n' | sort -rn | cutt -f2- | ct | fzf | - awk '{print $2}' | - xargs lessr + awk '{print $2}') + +if [ $(extname "$document") == ".txt" ]; then + lessr "$document" +else + open "$document" +fi