commit ffebf5278758948d88cf15d98ae64f06c7afb50a parent c3b4ffdc0738da19239b844cd7dcda0e1d705728 Author: Alex Balgavy <alex@balgavy.eu> Date: Fri, 6 Aug 2021 23:30:33 +0200 lf: add JSON preview via jq+bat Diffstat:
M | lf/preview | | | 6 | ++++++ |
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/lf/preview b/lf/preview @@ -22,6 +22,12 @@ case "$(printf "%s" "$1" | tr '[:upper:]' '[:lower:]')" in pandoc -s -t markdown -- "$1" | $pagercmd exit 1 ;; + *.json) + if command -v jq >/dev/null; then + if command -v bat >/dev/null; then jq < "$1" | $pagercmd --file-name "$1" + else jq < "$1" | $pagercmd; fi + else $pagercmd "$1"; fi + ;; *.csv) sed s/,/\\n/g "$1";; *.pdf) CACHE=$(mktemp)