From 078497570f58aa9fc4fe3a7cfd5951a67d7c8f5d Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Tue, 11 Jul 2023 10:53:52 +0200 Subject: clean up the handling of POWERLEVEL9K_AZURE_CLASSES and put it in all configs (#2379) This reverts commit 343d4f44e524e9674ecfb6f0df9114563232b889, reversing changes made to 4dca4bdfbb118953b73a131f511094462165971d. --- internal/p10k.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'internal') diff --git a/internal/p10k.zsh b/internal/p10k.zsh index c020cd9a..3ab76e3e 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4643,9 +4643,10 @@ _p9k_prompt_java_version_init() { } prompt_azure() { - local cfg=${AZURE_CONFIG_DIR:-$HOME/.azure}/azureProfile.json - if ! _p9k_cache_stat_get $0 $cfg; then - local name + local name cfg=${AZURE_CONFIG_DIR:-$HOME/.azure}/azureProfile.json + if _p9k_cache_stat_get $0 $cfg; then + name=$_p9k__cache_val[1] + else if (( $+commands[jq] )) && name="$(jq -r '[.subscriptions[]|select(.isDefault==true)|.name][]|strings' $cfg 2>/dev/null)"; then name=${name%%$'\n'*} elif ! name="$(az account show --query name --output tsv 2>/dev/null)"; then @@ -4653,16 +4654,15 @@ prompt_azure() { fi _p9k_cache_stat_set "$name" fi + [[ -n $name ]] || return local pat class state for pat class in "${_POWERLEVEL9K_AZURE_CLASSES[@]}"; do - name="${_p9k__cache_val[1]//\%/%%}" if [[ $name == ${~pat} ]]; then [[ -n $class ]] && state=_${${(U)class}//İ/I} break fi done - [[ -n $_p9k__cache_val[1] ]] || return - _p9k_prompt_segment "$0$state" "blue" "white" "AZURE_ICON" 0 '' "${_p9k__cache_val[1]//\%/%%}" + _p9k_prompt_segment "$0$state" "blue" "white" "AZURE_ICON" 0 '' "${name//\%/%%}" } _p9k_prompt_azure_init() { @@ -9375,7 +9375,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file && -n $__p9k_instant_p zf_rm -f -- $__p9k_instant_prompt_dump_file{,.zwc} 2>/dev/null fi -typeset -g P9K_VERSION=1.19.1 +typeset -g P9K_VERSION=1.19.2 unset VSCODE_SHELL_INTEGRATION _p9k_init_ssh -- cgit v1.2.3