Return 1 when GNU Core Utilities are not found
This commit is contained in:
parent
647ac1ac00
commit
9155aea2db
@ -5,8 +5,12 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if (( $+commands[gdircolors] )); then
|
||||
function __gnu_utils {
|
||||
# Check for the presence of GNU Core Utilities.
|
||||
if (( ! $+commands[gdircolors] )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
function __gnu_utils {
|
||||
emulate -L zsh
|
||||
local gcmds
|
||||
local gcmd
|
||||
@ -43,32 +47,31 @@ if (( $+commands[gdircolors] )); then
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
__gnu_utils;
|
||||
}
|
||||
__gnu_utils;
|
||||
|
||||
function hash {
|
||||
function hash {
|
||||
if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then
|
||||
builtin hash "$@"
|
||||
__gnu_utils
|
||||
else
|
||||
builtin hash "$@"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
function rehash {
|
||||
function rehash {
|
||||
hash -r "$@"
|
||||
}
|
||||
}
|
||||
|
||||
# A sensible default for ls.
|
||||
alias ls='ls --group-directories-first'
|
||||
# A sensible default for ls.
|
||||
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
|
||||
eval $(gdircolors "$HOME/.dir_colors")
|
||||
fi
|
||||
alias ls="$aliases[ls] --color=auto"
|
||||
else
|
||||
else
|
||||
alias ls="$aliases[ls] -F"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user