scripts/preview: add gojq/jaq to *.json preview option

This commit is contained in:
Hoang Nguyen 2024-01-27 00:00:00 +07:00
parent 01cf930d09
commit 28f0c9875f
Signed by: folliehiyuki
GPG Key ID: B0567C20730E9B11
3 changed files with 5 additions and 5 deletions

View File

@ -213,7 +213,7 @@ filetype {*.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus},<au
" Video
filextype {*.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
\*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
\*.fl[icv],*.m2v,*.mov,*.webm,,*.m4v,*.r[am],*.divx,
\*.as[fx]},<video/*>
\ mpv %c %f,
\ ffplay -fs -hide_banner -autoexit %f,

View File

@ -17,7 +17,7 @@ case "$1" in
*.doc) catdoc -- "$1" || pandoc -s -t markdown -- "$1" ;;
*.docx) pandoc -s -t markdown -- "$1" ;;
*.odt|*.ott|*.stw|*.sxc) pandoc -s -t markdown -- "$1" || odt2txt "$1" ;;
*.json|*.jsonc) jq . "$1" || python3 -m json.tool -- "$1" ;;
*.json|*.jsonc) gojq -C . "$1" || jaq --color always . "$1" || jq . "$1" || python3 -m json.tool -- "$1" ;;
*.[1-8]) man "$1" | col -b ;;
# Then fallback to mimetypes
*)
@ -37,7 +37,7 @@ case "$1" in
|application/x-lzop|application/x-lz4|application/x-lrzip)
bsdtar -tf "$1" ;;
application/json)
jq . "$1" || python3 -m json.tool -- "$1" || bat --style=plain --color=always "$1" ;;
gojq -C . "$1" || jaq --color always . "$1" || jq . "$1" || python3 -m json.tool -- "$1" || bat --style=plain --color=always "$1" ;;
text/*|application/javascript)
bat --style=plain --color=always "$1" ;;
*)

View File

@ -25,7 +25,7 @@ case "$1" in
*.doc) catdoc -- "$1" || pandoc -s -t markdown -- "$1" ;;
*.docx) pandoc -s -t markdown -- "$1" ;;
*.odt|*.ott|*.stw|*.sxc) pandoc -s -t markdown -- "$1" || odt2txt "$1" ;;
*.json|*.jsonc) jq . "$1" || python3 -m json.tool -- "$1" ;;
*.json|*.jsonc) gojq -C . "$1" || jaq --color always . "$1" || jq . "$1" || python3 -m json.tool -- "$1" ;;
*.[1-8]) man "$1" | col -b ;;
# Then fallback to mimetypes
*)
@ -46,7 +46,7 @@ case "$1" in
video/*)
exiftool "$1" || fprobe -pretty "$1" 2>&1 ;;
application/json)
jq . "$1" || python3 -m json.tool -- "$1" || bat --style=plain --color=always "$1" ;;
gojq -C . "$1" || jaq --color always . "$1" || jq . "$1" || python3 -m json.tool -- "$1" || bat --style=plain --color=always "$1" ;;
text/*|application/javascript)
bat --style plain --color=always "$1" ;;
*)