JSON preview even without ext

This commit is contained in:
Alexander Bocken 2021-06-28 13:35:33 +02:00
parent e3284f4b7c
commit e16dcb713c
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

View File

@ -338,8 +338,12 @@ handle_mime() {
} }
handle_fallback() { handle_fallback() {
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5 if [ "$(file --dereference --brief -- "${FILE_PATH}"| cut -d' ' -f1)" = "JSON" ]; then
exit 1 jq --color-output . "${FILE_PATH}" && exit 5
else
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5
exit 1
fi
} }