diary-list (482B)
1 #!/bin/bash 2 3 # Lists diary entry name and first line with fzf 4 # the filepath of the chosen entry is printed to stdout 5 6 ENTRIES_DIR=${DIARY_DIRECTORY:-"/Users/synox/diary"} 7 GPG_CMD=${DIARY_GPG:-"gpg2"} 8 9 ( 10 # for file in $ENTRIES_DIR/*.txt*; do 11 ls $ENTRIES_DIR/*.txt* | tac | while read file; do 12 echo "$(basename "$file" .txt.gpg) - $($GPG_CMD --decrypt --output "-" --yes --quiet "$file" | head -n 1)" 13 done 14 ) | fzf | awk -F' ' -v dir=$ENTRIES_DIR '{print (dir "/" $1 ".txt.gpg") }'