mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-17 02:00:07 +00:00
display the new rustc version when rustc is upgraded; fixes #365
This commit is contained in:
parent
339703e2b1
commit
d5cff592c6
1 changed files with 21 additions and 4 deletions
|
@ -2179,9 +2179,7 @@ instant_prompt_root_indicator() { prompt_root_indicator; }
|
|||
################################################################
|
||||
# Segment to display Rust version number
|
||||
prompt_rust_version() {
|
||||
_p9k_cached_cmd_stdout rustc --version || return
|
||||
local v=${${_p9k_ret#rustc }%% *}
|
||||
[[ -n $v ]] || return
|
||||
(( $+commands[rustc] )) || return
|
||||
if (( _POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY )); then
|
||||
local dir=$_p9k_pwd_a
|
||||
while true; do
|
||||
|
@ -2190,6 +2188,25 @@ prompt_rust_version() {
|
|||
dir=${dir:h}
|
||||
done
|
||||
fi
|
||||
local rustc=$commands[rustc] so
|
||||
if (( $+commands[ldd] )); then
|
||||
if _p9k_cache_stat_get $0_so $rustc; then
|
||||
so=$_p9k_cache_val[1]
|
||||
else
|
||||
local line match
|
||||
for line in "${(@f)$(ldd $rustc 2>/dev/null)}"; do
|
||||
[[ $line == (#b)[[:space:]]#librustc_driver[^[:space:]]#.so' => '(*)' (0x'[[:xdigit:]]#')' ]] || continue
|
||||
so=$match[1]
|
||||
break
|
||||
done
|
||||
_p9k_cache_stat_set "$so"
|
||||
fi
|
||||
fi
|
||||
if ! _p9k_cache_stat_get $0_v $rustc $so; then
|
||||
_p9k_cache_stat_set "$($rustc --version 2>/dev/null)"
|
||||
fi
|
||||
local v=${${_p9k_cache_val[1]#rustc }%% *}
|
||||
[[ -n $v ]] || return
|
||||
_p9k_prompt_segment "$0" "darkorange" "$_p9k_color1" 'RUST_ICON' 0 '' "${v//\%/%%}"
|
||||
}
|
||||
|
||||
|
@ -5413,7 +5430,7 @@ _p9k_must_init() {
|
|||
[[ $sig == $_p9k__param_sig ]] && return 1
|
||||
_p9k_deinit
|
||||
fi
|
||||
_p9k__param_pat=$'v13\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
|
||||
_p9k__param_pat=$'v14\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'
|
||||
|
|
Loading…
Reference in a new issue