mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-01-05 20:58:51 +01:00
batpipe: Change the install commands to enable color automatically
This commit is contained in:
parent
672b4814ec
commit
6497bc04a0
@ -81,11 +81,30 @@ if [[ "$#" -eq 0 ]]; then
|
||||
printc '%{YELLOW}set -e %{CLEAR}LESSCLOSE;\n'
|
||||
;;
|
||||
*) # Bash-like
|
||||
printc '%{MAGENTA}LESSOPEN%{YELLOW}=%{CYAN}"|%s %%s"%{CLEAR};\n' "$SELF"
|
||||
printc '%{MAGENTA}LESSOPEN%{CLEAR}=%{CYAN}"|%s %%s"%{CLEAR};\n' "$SELF"
|
||||
printc '%{YELLOW}export%{CLEAR} LESSOPEN;\n' "$SELF"
|
||||
printc '%{YELLOW}unset%{CLEAR} LESSCLOSE;\n'
|
||||
;;
|
||||
esac
|
||||
|
||||
# Print the commands required to use color in `less` with `batpipe`.
|
||||
if [[ -t 1 ]]; then
|
||||
printc "\n%{DIM}# The following will enable colors when using batpipe with less:\n"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
case "$(basename -- "${detected_shell:bash}")" in
|
||||
fish) # Fish
|
||||
printc '%{YELLOW}set -x %{CLEAR}LESS %{CYAN}"%{MAGENTA}$LESS%{CYAN} -R"%{CLEAR};\n' "$SELF"
|
||||
printc '%{YELLOW}set -x %{CLEAR}BATPIPE %{CYAN}"color"%{CLEAR};\n'
|
||||
;;
|
||||
*) # Bash-like
|
||||
printc '%{MAGENTA}LESS%{CLEAR}=%{CYAN}"%{MAGENTA}$LESS%{CYAN} -R"%{CLEAR};\n' "$SELF"
|
||||
printc '%{MAGENTA}BATPIPE%{CLEAR}=%{CYAN}"color"%{CLEAR};\n' "$SELF"
|
||||
printc '%{YELLOW}export%{CLEAR} LESS;\n' "$SELF"
|
||||
printc '%{YELLOW}export%{CLEAR} BATPIPE;\n' "$SELF"
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user