Update scripts to use $EXECUTABLE_BAT instead of $BAT

This commit is contained in:
Ethan P 2020-04-08 03:15:02 -07:00
parent c4af3eb637
commit a91ee96e6a
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA
6 changed files with 9 additions and 11 deletions

View File

@ -314,6 +314,8 @@ if [[ "$OPT_BAT" != "bat" ]]; then
printc "%{YELLOW}WARNING: Bash cannot execute the specified file.\n" 1>&2
printc "%{YELLOW} The finished scripts may not run properly.%{CLEAR}\n" 1>&2
fi
EXECUTABLE_BAT="$OPT_BAT"
printc "\n" 1>&2
fi

View File

@ -8,7 +8,7 @@
# Gets the current bat version.
bat_version() {
"$BAT" --version | cut -d ' ' -f 2
"$EXECUTABLE_BAT" --version | cut -d ' ' -f 2
return
}

View File

@ -7,7 +7,6 @@
# -----------------------------------------------------------------------------
# shellcheck disable=SC1090
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
BAT="bat"
source "${LIB}/constants.sh"
source "${LIB}/print.sh"
source "${LIB}/pager.sh"
@ -201,7 +200,7 @@ main() {
FIRST_PRINT=false
# Print the file.
"$BAT" "${BAT_ARGS[@]}" \
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" \
"${LAST_LR[@]}" \
"${LAST_LH[@]}" \
--style="${BAT_STYLE}${OPT_SNIP}" \

View File

@ -7,7 +7,6 @@
# -----------------------------------------------------------------------------
# shellcheck disable=SC1090 disable=SC2155
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
BAT="bat"
if [[ -n "${MANPAGER}" ]]; then BAT_PAGER="$MANPAGER"; fi
source "${LIB}/constants.sh"
source "${LIB}/pager.sh"
@ -29,7 +28,7 @@ else
BAT_ARGS=("--color=never --decorations=never")
fi
# -----------------------------------------------------------------------------
export MANPAGER='sh -c "col -bx | '"$(printf "%q" "$BAT")"' --language=man --style=grid '"${BAT_ARGS[*]}"'"'
export MANPAGER='sh -c "col -bx | '"$(printf "%q" "$EXECUTABLE_BAT")"' --language=man --style=grid '"${BAT_ARGS[*]}"'"'
export MANROFFOPT='-c'
if [[ -n "${SCRIPT_PAGER_CMD}" ]]; then

View File

@ -7,7 +7,6 @@
# -----------------------------------------------------------------------------
# shellcheck disable=SC1090
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
BAT="bat"
source "${LIB}/constants.sh"
source "${LIB}/opt.sh"
source "${LIB}/opt_hooks.sh"
@ -35,7 +34,7 @@ watcher_entr_watch() {
fi
entr "${ENTR_ARGS[@]}" \
"$BAT" "${BAT_ARGS[@]}" \
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" \
--terminal-width="$TERM_WIDTH" \
--paging=never \
"$@" \
@ -98,7 +97,7 @@ watcher_poll_watch() {
clear
fi
"$BAT" "${BAT_ARGS[@]}" \
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" \
--terminal-width="$TERM_WIDTH" \
--paging=never \
"${files[@]}"

View File

@ -7,7 +7,6 @@
# -----------------------------------------------------------------------------
# shellcheck disable=SC1090
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
BAT="bat"
source "${LIB}/constants.sh"
source "${LIB}/opt.sh"
source "${LIB}/opt_hooks.sh"
@ -140,10 +139,10 @@ extname() {
print_file() {
if [[ "${#BAT_ARGS[@]}" -eq 0 ]]; then
"$BAT" "$@"
"$EXECUTABLE_BAT" "$@"
return $?
else
"$BAT" "${BAT_ARGS[@]}" "$@"
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" "$@"
return $?
fi
}