my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
897 B

3 years ago
  1. jenvdirs=("$HOME/.jenv" "/usr/local/bin/jenv" "/usr/local/jenv" "/opt/jenv")
  2. FOUND_JENV=0
  3. for jenvdir in $jenvdirs; do
  4. if [[ -d "${jenvdir}/bin" ]]; then
  5. FOUND_JENV=1
  6. break
  7. fi
  8. done
  9. if [[ $FOUND_JENV -eq 0 ]]; then
  10. if (( $+commands[brew] )) && jenvdir="$(brew --prefix jenv)"; then
  11. [[ -d "${jenvdir}/bin" ]] && FOUND_JENV=1
  12. fi
  13. fi
  14. if [[ $FOUND_JENV -eq 1 ]]; then
  15. (( $+commands[jenv] )) || export PATH="${jenvdir}/bin:$PATH"
  16. eval "$(jenv init - zsh)"
  17. function jenv_prompt_info() {
  18. local version="$(jenv version-name 2>/dev/null)"
  19. echo "${version:gs/%/%%}"
  20. }
  21. if [[ -d "${jenvdir}/versions" ]]; then
  22. export JENV_ROOT=$jenvdir
  23. fi
  24. else
  25. function jenv_prompt_info() {
  26. local version="$(java -version 2>&1 | cut -d' ' -f2)"
  27. echo "system: ${version:gs/%/%%}"
  28. }
  29. fi
  30. unset jenvdir jenvdirs FOUND_JENV