mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-12 17:20:40 +01:00
Update scripts to use $EXECUTABLE_BAT instead of $BAT
This commit is contained in:
parent
c4af3eb637
commit
a91ee96e6a
2
build.sh
2
build.sh
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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}" \
|
||||
|
@ -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
|
||||
|
@ -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[@]}"
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user