tCache list of PDFs - scholarref - tools for DOI and BiBTeX reference extraction, fetching, and parsing
 (HTM) git clone git://src.adamsgaard.dk/scholarref
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 871df126f10a6c991f5f3fe8d1af2240663a5d6b
 (DIR) parent 50d8641f0597163394bc8d46097bd8b9ff32371d
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Fri, 20 Dec 2019 15:24:23 +0100
       
       Cache list of PDFs
       
       Diffstat:
         M articlesearch                       |      32 ++++++++++++++++++++++++++++---
       
       1 file changed, 29 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/articlesearch b/articlesearch
       t@@ -4,9 +4,35 @@ set -e
        # List of directory paths that contain PDFs
        dir="$HOME/articles $HOME/books"
        
       -query="$(find $dir -type f -iname "*.pdf" -o -iname "*.eps" -o -iname "*.gs" -o -iname "*.djvu" -o -iname "*.epub" | \
       -         sed "s|$HOME/||" | dmenu -i -l 10 -p "Search publications:")" || exit 1
       -action="$(printf "Open\nGet DOI\nSci-Hub\nAdd reference" | dmenu -i -p "Action:")"
       +cachedir="$HOME/.cache"
       +cachefile="$cachedir/articlesearch"
       +
       +update_cache() {
       +        mkdir -p "$cachedir"
       +        find $dir -type f \
       +                -iname "*.pdf" -o -iname "*.eps" -o -iname "*.gs" \
       +                -o -iname "*.djvu" -o -iname "*.epub" > "$cachefile"
       +}
       +
       +if [ "$1" = "-u" ]; then
       +        update_cache
       +        exit 0
       +fi
       +
       +if [ ! -e "$cachefile" ]; then
       +        update_cache
       +fi
       +
       +query="$((echo "Update cache"; sed "s|$HOME/||" "$cachefile") | \
       +         dmenu -i -l 10 -p "Search publications:")" || exit 1
       +
       +if [ "$query" = "Update cache" ]; then
       +        update_cache
       +        exit 0
       +fi
       +
       +action="$(printf "Open\nGet DOI\nSci-Hub\nAdd reference" | \
       +          dmenu -i -p "Action:")"
        
        if [ "$action" = "Open" ]; then
                if [ -f "$HOME/$query" ]; then