lib/helpers: invert test in _bash_it_homebrew_check()
Check if `brew` is installed every time, and *unset* `$BASH_IT_HOMEBREW_PREFIX` if not found. This accounts for the edge-case of a user _uninstalling_ Homebrew without restarting the shell.pull/1910/head
parent
65ef8e2e8b
commit
0f28824ad5
|
|
@ -50,14 +50,17 @@ function _completion_exists ()
|
||||||
|
|
||||||
function _bash_it_homebrew_check()
|
function _bash_it_homebrew_check()
|
||||||
{
|
{
|
||||||
if [[ "${BASH_IT_HOMEBREW_PREFIX:-unset}" == 'unset' ]]
|
if _binary_exists 'brew'
|
||||||
then # variable isn't set
|
then # Homebrew is installed
|
||||||
if _binary_exists 'brew'
|
if [[ "${BASH_IT_HOMEBREW_PREFIX:-unset}" == 'unset' ]]
|
||||||
then # Homebrew is installed
|
then # variable isn't set
|
||||||
BASH_IT_HOMEBREW_PREFIX="$(brew --prefix)"
|
BASH_IT_HOMEBREW_PREFIX="$(brew --prefix)"
|
||||||
else # Homebrew is not installed.
|
else
|
||||||
false # return failure if brew not installed.
|
true # Variable is set already, don't invoke `brew`.
|
||||||
fi
|
fi
|
||||||
|
else # Homebrew is not installed.
|
||||||
|
BASH_IT_HOMEBREW_PREFIX= # clear variable, if set to anything.
|
||||||
|
false # return failure if brew not installed.
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue