Return 1 when GNU Core Utilities are not found

This commit is contained in:
Sorin Ionescu 2012-03-28 12:23:02 -04:00
parent 647ac1ac00
commit 9155aea2db

View File

@ -5,8 +5,12 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
if (( $+commands[gdircolors] )); then # Check for the presence of GNU Core Utilities.
function __gnu_utils { if (( ! $+commands[gdircolors] )); then
return 1
fi
function __gnu_utils {
emulate -L zsh emulate -L zsh
local gcmds local gcmds
local gcmd local gcmd
@ -43,32 +47,31 @@ if (( $+commands[gdircolors] )); then
done done
return 0 return 0
} }
__gnu_utils; __gnu_utils;
function hash { function hash {
if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then
builtin hash "$@" builtin hash "$@"
__gnu_utils __gnu_utils
else else
builtin hash "$@" builtin hash "$@"
fi fi
} }
function rehash { function rehash {
hash -r "$@" hash -r "$@"
} }
# A sensible default for ls. # A sensible default for ls.
alias ls='ls --group-directories-first' alias ls='ls --group-directories-first'
if zstyle -t ':omz:alias:ls' color; then if zstyle -t ':omz:alias:ls' color; then
if [[ -f "$HOME/.dir_colors" ]]; then if [[ -f "$HOME/.dir_colors" ]]; then
eval $(gdircolors "$HOME/.dir_colors") eval $(gdircolors "$HOME/.dir_colors")
fi fi
alias ls="$aliases[ls] --color=auto" alias ls="$aliases[ls] --color=auto"
else else
alias ls="$aliases[ls] -F" alias ls="$aliases[ls] -F"
fi
fi fi