mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-13 17:50:56 +01:00
Add color option to batman
This commit is contained in:
parent
fa8a3bb850
commit
d9e34e2d5f
@ -9,13 +9,24 @@ LIB="$(cd "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}"
|
||||
BAT="bat"
|
||||
source "${LIB}/print.sh"
|
||||
source "${LIB}/opt.sh"
|
||||
source "${LIB}/version.sh"
|
||||
source "${LIB}/opt_hooks.sh"
|
||||
# -----------------------------------------------------------------------------
|
||||
hook_color
|
||||
# -----------------------------------------------------------------------------
|
||||
MAN_ARGS=()
|
||||
BAT_ARGS=()
|
||||
|
||||
export MANPAGER='sh -c "col -bx | '"$(printf "%q" "$BAT")"' --language man --style grid"'
|
||||
while shiftopt; do MAN_ARGS+=("$OPT"); done
|
||||
if "$OPT_COLOR"; then
|
||||
BAT_ARGS="--color=always --decorations=always"
|
||||
else
|
||||
BAT_ARGS="--color=never --decorations=never"
|
||||
fi
|
||||
# -----------------------------------------------------------------------------
|
||||
export MANPAGER='sh -c "col -bx | '"$(printf "%q" "$BAT")"' --language=man --style=grid '"${BAT_ARGS[@]}"'"'
|
||||
export MANROFFOPT='-c'
|
||||
export BAT_PAGER="$PAGER"
|
||||
|
||||
command man "$@"
|
||||
command man "${MAN_ARGS[@]}"
|
||||
exit $?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user