From d4ba22670a5b6da4629bfc6a94db86917da122db Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 2 Jan 2025 21:14:07 +0100 Subject: [PATCH] Refactor 'fzf-book' --- .bin/fzf-book | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.bin/fzf-book b/.bin/fzf-book index 19791f1..61f61ab 100755 --- a/.bin/fzf-book +++ b/.bin/fzf-book @@ -3,8 +3,12 @@ # Generate menu of book filenames and save paths # Preview window contains metadata +function get_book_paths { + find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort +} + function select_file { - echo "$(find /home/h/doc/books/ -regex '.*\.\(pdf\|epub\|djvu\)' -type f | sort | fzf --delimiter=/ --with-nth=-1)" + get_book_paths | fzf --delimiter=/ --with-nth=-1 } function open {