From 58d3acfd88dc772116ecd84a30e34b2d75cf147d Mon Sep 17 00:00:00 2001 From: cornfeedhobo Date: Sat, 7 Mar 2020 21:05:00 -0600 Subject: [PATCH] add goenv plugin --- plugins/available/goenv.plugin.bash | 18 ++++++++++++++++++ 1 file changed, 18 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..584365b7 --- /dev/null +++ b/plugins/available/goenv.plugin.bash @@ -0,0 +1,18 @@ +cite about-plugin +about-plugin 'load goenv, if you are using it' + +# Don't modify the environment if we can't find the tool: +# - Check if in $PATH already +# - Check if installed manually to $HOME +_command_exists goenv || + [[ -x "$HOME/.goenv/bin/goenv" ]] || + return + +# Set GOENV_ROOT, if not already set +export GOENV_ROOT="${GOENV_ROOT:-$HOME/.goenv}" + +# Add GOENV_ROOT/bin to PATH, if that's where it's installed +[[ -x "$HOME/.goenv/bin/goenv" ]] && pathmunge "$GOENV_ROOT/bin" + +# Initialize goenv +eval "$(goenv init - bash)"