Commit cb7a3e38 authored by Marc Cornellà's avatar Marc Cornellà
Browse files

Merge branch 'jburwell/jenv-plugin'

Closes #3406
Closes #4972
Closes #4523
Closes #5964
parents ff6b4c83 3a822bb5
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# Real implementations will be used when the respective plugins are loaded # Real implementations will be used when the respective plugins are loaded
function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
virtualenv_prompt_info { virtualenv_prompt_info jenv_prompt_info {
return 1 return 1
} }
......
# jenv oh-my-zsh plugin
[jenv](http://www.jenv.be/) is a Java version manager similiar to [rbenv](http://rbenv.org/) and [pyenv]|(https://github.com/yyuu/pyenv). This plugin initializes jenv and adds provides the jenv_prompt_info function to add Java version information to prompts.
jenvdirs=("$HOME/.jenv" "/usr/local/jenv" "/opt/jenv")
FOUND_JENV=0
for jenvdir in $jenvdirs; do
if [[ -d "${jenvdir}/bin" ]]; then
FOUND_JENV=1
break
fi
done
if [[ $FOUND_JENV -eq 0 ]]; then
if (( $+commands[brew] )) && jenvdir="$(brew --prefix jenv)"; then
FOUND_JENV=1
fi
fi
if [[ $FOUND_JENV -eq 1 ]]; then
export PATH="${jenvdir}/bin:$PATH"
eval "$(jenv init - zsh)"
function jenv_prompt_info() { jenv version-name 2>/dev/null }
if [[ -d "${jenvdir}/versions" ]]; then
export JENV_ROOT=$jenvdir
fi
else
function jenv_prompt_info() { echo "system: $(java -version 2>&1 | cut -f 2 -d ' ')" }
fi
unset jenvdir FOUND_JENV
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment