Skip to content

Commit

Permalink
fix bugs in cpu_arch
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Dec 2, 2022
1 parent 9f0751c commit edafcb5
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions internal/p10k.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5656,10 +5656,16 @@ prompt_cpu_arch() {
state=$_p9k__cache_val[1]
text=$_p9k__cache_val[2]
else
text=$(command machine) 2>/dev/null && [[ $text == [a-zA-Z][a-zA-Z0-9_]# ]] ||
text=$(command arch) 2>/dev/null && [[ $text == [a-zA-Z][a-zA-Z0-9_]# ]] ||
text=
state=_${(U)text}
local cmd
for cmd in machine arch; do
(( $+commands[$cmd] )) || continue
if text=$(command -- $cmd) 2>/dev/null && [[ $text == [a-zA-Z][a-zA-Z0-9_]# ]]; then
break
else
text=
fi
done
state=_${${(U)text}//İ/I}
_p9k_cache_ephemeral_set "$state" "$text"
fi
if [[ -n $text ]]; then
Expand All @@ -5669,8 +5675,8 @@ prompt_cpu_arch() {
(( _p9k__has_upglob )) || typeset -g "_p9k__segment_val_${_p9k__prompt_side}[_p9k__segment_index]"=$_p9k__prompt[len+1,-1]
}

_p9k_prompt_arch_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[arch]'
_p9k_prompt_cpu_arch_init() {
typeset -g "_p9k__segment_cond_${_p9k__prompt_side}[_p9k__segment_index]"='$commands[machine]$commands[arch]'
}

# Use two preexec hooks to survive https://github.com/MichaelAquilina/zsh-you-should-use with
Expand Down Expand Up @@ -8339,7 +8345,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit
fi
_p9k__param_pat=$'v138\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat=$'v139\1'${(q)ZSH_VERSION}$'\1'${(q)ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$__p9k_force_term_shell_integration$'\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'
Expand Down

0 comments on commit edafcb5

Please sign in to comment.