Fixed highlighting with prettybat

This commit is contained in:
Ethan P 2019-06-21 14:48:21 -07:00
parent ce0c2a57f1
commit 147c823c1d
No known key found for this signature in database
GPG Key ID: 1F8DF8091CD46FBC

View File

@ -89,9 +89,9 @@ prettify() {
batify() { batify() {
if [[ "${#BAT_ARGS[@]}" -eq 0 ]]; then if [[ "${#BAT_ARGS[@]}" -eq 0 ]]; then
bat "$1" bat "$@"
else else
bat "${BAT_ARGS[@]}" "$1" bat "${BAT_ARGS[@]}" "$@"
fi fi
} }
@ -99,13 +99,13 @@ EXIT=0
for file in "${FILES[@]}"; do for file in "${FILES[@]}"; do
file_pretty="$(prettify "$file")" file_pretty="$(prettify "$file")"
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
batify "-" <<< "$file_pretty" batify --language="${file##*.}" - <<< "$file_pretty"
exitcode=$? exitcode=$?
else else
batify "$file" batify "$file"
exitcode=$? exitcode=$?
fi fi
if [[ $exitcode -ne 0 ]]; then if [[ $exitcode -ne 0 ]]; then
EXIT=$exitcode EXIT=$exitcode
fi fi