From 73a21f74359db0ee032b6f1c89cec519e419930d Mon Sep 17 00:00:00 2001 From: David Farrell Date: Mon, 9 Mar 2020 11:32:58 -0700 Subject: [PATCH] Add goenv plugin --- plugins/available/goenv.plugin.bash | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/available/goenv.plugin.bash diff --git a/plugins/available/goenv.plugin.bash b/plugins/available/goenv.plugin.bash new file mode 100644 index 00000000..c8d0f5ba --- /dev/null +++ b/plugins/available/goenv.plugin.bash @@ -0,0 +1,21 @@ +cite about-plugin +about-plugin 'Init goenv, if installed. Plays nicely with package managers' + +# Try to set GOENV_ROOT if not already set +if [ -z "${GOENV_ROOT}" ]; then + # Bail if cannot be set + if [ ! -d "$HOME/.goenv" ]; then + return + fi + export GOENV_ROOT="$HOME/.goenv" +fi + +# Add GOENV_ROOT/bin to path if goenv not already on path +if ! _command_exists goenv && [ -x "${GOENV_ROOT}/bin/goenv" ]; then + pathmunge "$GOENV_ROOT/bin" +fi + +# Initialize goenv - Play nicely if goenv not on path +if _command_exists goenv ; then + eval "$(goenv init - bash)" +fi