From e52d1a257a02cd4c5ef84d63e494ba6a5465ab55 Mon Sep 17 00:00:00 2001 From: Ryan Timmons Date: Sun, 8 Nov 2015 19:25:18 -0500 Subject: [PATCH] Enable using 'gls' on any OS --- lib/theme-and-appearance.zsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index ebb11fb31..ca1efc490 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -6,17 +6,18 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [ "$DISABLE_LS_COLORS" != "true" ] then # Find the option for using colors in ls, depending on the version: Linux or BSD - if [[ "$(uname -s)" == "NetBSD" ]]; 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' - elif [[ "$(uname -s)" == "OpenBSD" ]]; then + # Allow any system with "gls" to use that if available. + if [[ "$(uname -s)" == "OpenBSD" ]]; then # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, # with color and multibyte support) are available from ports. "colorls" # will be installed on purpose and can't be pulled in by installing # coreutils, so prefer it to "gls". gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' 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 ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' fi