mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-03 04:20:01 +02:00
Enable using 'gls' on any OS
This commit is contained in:
parent
e44aa50301
commit
e52d1a257a
1 changed files with 6 additions and 5 deletions
|
|
@ -6,17 +6,18 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||||
if [ "$DISABLE_LS_COLORS" != "true" ]
|
if [ "$DISABLE_LS_COLORS" != "true" ]
|
||||||
then
|
then
|
||||||
# Find the option for using colors in ls, depending on the version: Linux or BSD
|
# Find the option for using colors in ls, depending on the version: Linux or BSD
|
||||||
if [[ "$(uname -s)" == "NetBSD" ]]; then
|
# Allow any system with "gls" to use that if available.
|
||||||
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
|
if [[ "$(uname -s)" == "OpenBSD" ]]; then
|
||||||
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
|
||||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
|
||||||
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
|
|
||||||
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
|
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
|
||||||
# with color and multibyte support) are available from ports. "colorls"
|
# with color and multibyte support) are available from ports. "colorls"
|
||||||
# will be installed on purpose and can't be pulled in by installing
|
# will be installed on purpose and can't be pulled in by installing
|
||||||
# coreutils, so prefer it to "gls".
|
# coreutils, so prefer it to "gls".
|
||||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||||
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
|
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
|
||||||
|
elif [[ "$(uname -s)" == "NetBSD" || $+commands[gls] ]]; then
|
||||||
|
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
|
||||||
|
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
||||||
|
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||||
else
|
else
|
||||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue