summaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-12-02 12:34:51 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-12-02 12:34:51 +0300
commitedafcb5a7dbe809d40264643a55b72a25c3bbe05 (patch)
treef4a6af92ffba1dd1358b5c1d32ccadc74803f730 /internal/p10k.zsh
parent9f0751c2e34052f12375a2d9c181ea792d750612 (diff)
fix bugs in cpu_arch
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh20
1 files changed, 13 insertions, 7 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index a5e004b3..b90b747e 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -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
@@ -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
@@ -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'