Simply pathmunge / bail logic
parent
dc2c9cfd38
commit
8c5581a52b
|
|
@ -6,20 +6,18 @@ about-plugin 'Init goenv, if installed. Plays nicely with package managers'
|
||||||
# NOTE: We don't export it yet, since we might still bail
|
# NOTE: We don't export it yet, since we might still bail
|
||||||
GOENV_ROOT="${GOENV_ROOT:-${HOME}/.goenv}"
|
GOENV_ROOT="${GOENV_ROOT:-${HOME}/.goenv}"
|
||||||
|
|
||||||
# Look for goenv command
|
# Look for goenv command, adding to path if needbe
|
||||||
if ! _command_exists goenv ; then
|
if ! _command_exists goenv && [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then
|
||||||
# Add it to the path if we find it, bail otherwise
|
pathmunge "${GOENV_ROOT}/bin"
|
||||||
if [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then
|
|
||||||
pathmunge "${GOENV_ROOT}/bin"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Since we didn't bail, export the value
|
# If we found the command, we're good to go
|
||||||
export GOENV_ROOT
|
if _command_exists goenv ; then
|
||||||
|
# Now its safe to export the value
|
||||||
|
export GOENV_ROOT
|
||||||
|
|
||||||
# Initialize goenv
|
# Initialize goenv
|
||||||
# NOTE: In the off-chance that goenv has already been initialized,
|
# NOTE: In the off-chance that goenv has already been initialized,
|
||||||
# it should be safe to re-initialize
|
# it should be safe to re-initialize
|
||||||
eval "$(goenv init - bash)"
|
eval "$(goenv init - bash)"
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue