1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-25 13:30:07 +00:00

bug fix: java version depends on JAVA_HOME (fixes #572)

This commit is contained in:
romkatv 2020-03-21 09:59:06 +01:00
parent 505a77f02e
commit e60aa8ad7d

View file

@ -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'