activate brew completions only if brew is available

This commit is contained in:
Steffen Vogel 2019-07-21 10:39:27 +02:00
parent 108be77525
commit 882e8e5ed9

View file

@ -42,12 +42,11 @@ if type doctl > /dev/null 2>&1; then
source <(doctl completion bash)
fi
HOMEBREW_PREFIX=$(brew --prefix)
if type brew &>/dev/null; then
if command -v brew; then
HOMEBREW_PREFIX=$(brew --prefix)
for COMPLETION in "$HOMEBREW_PREFIX"/etc/bash_completion.d/*; do
[[ -f $COMPLETION ]] && source "$COMPLETION"
done
if [[ -f ${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh ]]; then
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
fi