mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-01-22 05:08:36 +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}WARNING: Bash cannot execute the specified file.\n" 1>&2
|
||||||
printc "%{YELLOW} The finished scripts may not run properly.%{CLEAR}\n" 1>&2
|
printc "%{YELLOW} The finished scripts may not run properly.%{CLEAR}\n" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
EXECUTABLE_BAT="$OPT_BAT"
|
||||||
printc "\n" 1>&2
|
printc "\n" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
# Gets the current bat version.
|
# Gets the current bat version.
|
||||||
bat_version() {
|
bat_version() {
|
||||||
"$BAT" --version | cut -d ' ' -f 2
|
"$EXECUTABLE_BAT" --version | cut -d ' ' -f 2
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
|
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
|
||||||
BAT="bat"
|
|
||||||
source "${LIB}/constants.sh"
|
source "${LIB}/constants.sh"
|
||||||
source "${LIB}/print.sh"
|
source "${LIB}/print.sh"
|
||||||
source "${LIB}/pager.sh"
|
source "${LIB}/pager.sh"
|
||||||
@ -201,7 +200,7 @@ main() {
|
|||||||
FIRST_PRINT=false
|
FIRST_PRINT=false
|
||||||
|
|
||||||
# Print the file.
|
# Print the file.
|
||||||
"$BAT" "${BAT_ARGS[@]}" \
|
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" \
|
||||||
"${LAST_LR[@]}" \
|
"${LAST_LR[@]}" \
|
||||||
"${LAST_LH[@]}" \
|
"${LAST_LH[@]}" \
|
||||||
--style="${BAT_STYLE}${OPT_SNIP}" \
|
--style="${BAT_STYLE}${OPT_SNIP}" \
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# shellcheck disable=SC1090 disable=SC2155
|
# shellcheck disable=SC1090 disable=SC2155
|
||||||
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
|
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
|
if [[ -n "${MANPAGER}" ]]; then BAT_PAGER="$MANPAGER"; fi
|
||||||
source "${LIB}/constants.sh"
|
source "${LIB}/constants.sh"
|
||||||
source "${LIB}/pager.sh"
|
source "${LIB}/pager.sh"
|
||||||
@ -29,7 +28,7 @@ else
|
|||||||
BAT_ARGS=("--color=never --decorations=never")
|
BAT_ARGS=("--color=never --decorations=never")
|
||||||
fi
|
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'
|
export MANROFFOPT='-c'
|
||||||
|
|
||||||
if [[ -n "${SCRIPT_PAGER_CMD}" ]]; then
|
if [[ -n "${SCRIPT_PAGER_CMD}" ]]; then
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
|
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
|
||||||
BAT="bat"
|
|
||||||
source "${LIB}/constants.sh"
|
source "${LIB}/constants.sh"
|
||||||
source "${LIB}/opt.sh"
|
source "${LIB}/opt.sh"
|
||||||
source "${LIB}/opt_hooks.sh"
|
source "${LIB}/opt_hooks.sh"
|
||||||
@ -35,7 +34,7 @@ watcher_entr_watch() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
entr "${ENTR_ARGS[@]}" \
|
entr "${ENTR_ARGS[@]}" \
|
||||||
"$BAT" "${BAT_ARGS[@]}" \
|
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" \
|
||||||
--terminal-width="$TERM_WIDTH" \
|
--terminal-width="$TERM_WIDTH" \
|
||||||
--paging=never \
|
--paging=never \
|
||||||
"$@" \
|
"$@" \
|
||||||
@ -98,7 +97,7 @@ watcher_poll_watch() {
|
|||||||
clear
|
clear
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$BAT" "${BAT_ARGS[@]}" \
|
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" \
|
||||||
--terminal-width="$TERM_WIDTH" \
|
--terminal-width="$TERM_WIDTH" \
|
||||||
--paging=never \
|
--paging=never \
|
||||||
"${files[@]}"
|
"${files[@]}"
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
|
LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo ".")")/../lib" && pwd)"
|
||||||
BAT="bat"
|
|
||||||
source "${LIB}/constants.sh"
|
source "${LIB}/constants.sh"
|
||||||
source "${LIB}/opt.sh"
|
source "${LIB}/opt.sh"
|
||||||
source "${LIB}/opt_hooks.sh"
|
source "${LIB}/opt_hooks.sh"
|
||||||
@ -140,10 +139,10 @@ extname() {
|
|||||||
|
|
||||||
print_file() {
|
print_file() {
|
||||||
if [[ "${#BAT_ARGS[@]}" -eq 0 ]]; then
|
if [[ "${#BAT_ARGS[@]}" -eq 0 ]]; then
|
||||||
"$BAT" "$@"
|
"$EXECUTABLE_BAT" "$@"
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
"$BAT" "${BAT_ARGS[@]}" "$@"
|
"$EXECUTABLE_BAT" "${BAT_ARGS[@]}" "$@"
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user