Simply pathmunge / bail logic

pull/1515/head
David Farrell 2020-03-10 01:58:07 -07:00
parent dc2c9cfd38
commit 8c5581a52b
No known key found for this signature in database
GPG Key ID: 1CCA28D0E300B56F
1 changed files with 12 additions and 14 deletions

View File

@ -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
GOENV_ROOT="${GOENV_ROOT:-${HOME}/.goenv}"
# Look for goenv command
if ! _command_exists goenv ; then
# Add it to the path if we find it, bail otherwise
if [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then
pathmunge "${GOENV_ROOT}/bin"
else
return
fi
# Look for goenv command, adding to path if needbe
if ! _command_exists goenv && [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then
pathmunge "${GOENV_ROOT}/bin"
fi
# Since we didn't bail, export the value
export GOENV_ROOT
# If we found the command, we're good to go
if _command_exists goenv ; then
# Now its safe to export the value
export GOENV_ROOT
# Initialize goenv
# NOTE: In the off-chance that goenv has already been initialized,
# it should be safe to re-initialize
eval "$(goenv init - bash)"
# Initialize goenv
# NOTE: In the off-chance that goenv has already been initialized,
# it should be safe to re-initialize
eval "$(goenv init - bash)"
fi