1
0
Fork 0
mirror of synced 2024-11-26 09:15:34 -05:00

[utility] Use CLICOLOR for coloured output in BSD

instead of aliasing `ls` to `ls -G`.
CLICOLOR is detected not only by `ls`, but by `tree` too (starting with
version 1.8.0). See http://mama.indstate.edu/users/ice/tree/changes.html

It's probably more widely used by other tools too.
This commit is contained in:
Eric Nielsen 2018-11-19 17:13:45 -05:00
parent 1c23ea1604
commit 268a570ae3

View file

@ -22,15 +22,12 @@ if (( terminfo[colors] >= 8 )); then
else
# BSD
(( ! ${+CLICOLOR} )) && export CLICOLOR=1
(( ! ${+LSCOLORS} )) && export LSCOLORS='ExfxcxdxbxGxDxabagacad'
# stock OpenBSD ls does not support colors at all, but colorls does.
if [[ ${OSTYPE} == openbsd* ]]; then
if (( ${+commands[colorls]} )); then
alias ls='colorls -G'
fi
else
alias ls='ls -G'
if [[ ${OSTYPE} == openbsd* && ${+commands[colorls]} -ne 0 ]]; then
alias ls='colorls'
fi
fi