1
0
Fork 0

lf: cleanup preview

This commit is contained in:
Luca Bilke 2024-08-21 10:31:27 +02:00
parent 28e1a762fa
commit 5ca0c9822e
Signed by: luca
GPG Key ID: F6E11C9BAA7C82F5
1 changed files with 3 additions and 2 deletions

View File

@ -50,6 +50,7 @@ run() {
printf "%b" "\n${RED} ${l}${RESET}" printf "%b" "\n${RED} ${l}${RESET}"
done done
fi fi
exit 1
} }
mimetest() { mimetest() {
@ -67,7 +68,7 @@ mimetest() {
*/pkix-cert) run openssl x509 -text -noout -in "$f" ;; */pkix-cert) run openssl x509 -text -noout -in "$f" ;;
*opendocument*) run odt2txt "$f" ;; *opendocument*) run odt2txt "$f" ;;
*/markdown) */markdown)
[ ! -f "${CACHE}.txt" ] && run mdless "$f" --width "$w" >"${CACHE}.txt" [ ! -f "${CACHE}.txt" ] && run mdless "$f" >"${CACHE}.txt"
text "${CACHE}.txt" text "${CACHE}.txt"
;; ;;
*/html) run lynx -dump "$f" ;; */html) run lynx -dump "$f" ;;
@ -100,7 +101,7 @@ mimetest() {
esac esac
} }
CACHE="${XDG_CACHE_HOME}/lf/$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')" CACHE="${XDG_CACHE_HOME}/lf/$(stat --printf "%n\0%i\0%F\0%s\0%W\0%Y" -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')"
# Special cases # Special cases
[ "$(dirname "$(realpath "$f")" | rev | cut -d/ -f1 | rev)" = "factscache" ] && [ "$(dirname "$(realpath "$f")" | rev | cut -d/ -f1 | rev)" = "factscache" ] &&