diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-03-21 11:59:06 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-03-21 11:59:06 +0300 |
commit | e60aa8ad7ddb3cee71ef13e35a165228ed62423c (patch) | |
tree | aa3c649981e274384bb3fbdffb52cd7d70e0bd14 /internal/p10k.zsh | |
parent | 505a77f02eb87f5c049a80d81aef4a97b290ee01 (diff) |
bug fix: java version depends on JAVA_HOME (fixes #572)
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r-- | internal/p10k.zsh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 5f608c1c..9b3cc3f7 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4282,12 +4282,18 @@ prompt_java_version() { if (( _POWERLEVEL9K_JAVA_VERSION_PROJECT_ONLY )); then _p9k_upglob 'pom.xml|build.gradle.kts|build.sbt|deps.edn|project.clj|build.boot|*.(java|class|jar|gradle|clj|cljc)' && return fi - _p9k_cached_cmd 1 java -fullversion || return - local v=$_p9k__ret - v=${${v#*\"}%\"*} - (( _POWERLEVEL9K_JAVA_VERSION_FULL )) || v=${v%%-*} - [[ -n $v ]] || return - _p9k_prompt_segment "$0" "red" "white" "JAVA_ICON" 0 '' "${v//\%/%%}" + + local java=$commands[java] + if ! _p9k_cache_stat_get $0 $java ${JAVA_HOME:+$JAVA_HOME/release}; then + local v + v="$(java -fullversion 2>&1)" || v= + v=${${v#*\"}%\"*} + (( _POWERLEVEL9K_JAVA_VERSION_FULL )) || v=${v%%-*} + _p9k_cache_stat_set "${v//\%/%%}" + fi + + [[ -n $_p9k__cache_val[1] ]] || return + _p9k_prompt_segment "$0" "red" "white" "JAVA_ICON" 0 '' $_p9k__cache_val[1] } _p9k_prompt_java_version_init() { @@ -7483,7 +7489,7 @@ _p9k_must_init() { [[ $sig == $_p9k__param_sig ]] && return 1 _p9k_deinit fi - _p9k__param_pat=$'v75\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' + _p9k__param_pat=$'v76\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\1' _p9k__param_pat+=$'$GITSTATUS_ENABLE_LOGGING\1$GITSTATUS_DAEMON\1$GITSTATUS_NUM_THREADS\1' _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays\1' |