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

fix pattern coloration for azure defined classes

This commit is contained in:
BEN MANSOUR Mohamed Rafik 2023-07-10 22:07:28 +02:00
parent 4dca4bdfbb
commit 0c28fec137
2 changed files with 30 additions and 2 deletions

View file

@ -1404,8 +1404,35 @@
# Show azure only when the command you are typing invokes one of these tools. # Show azure only when the command you are typing invokes one of these tools.
# Tip: Remove the next line to always show azure. # Tip: Remove the next line to always show azure.
typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt' typeset -g POWERLEVEL9K_AZURE_SHOW_ON_COMMAND='az|terraform|pulumi|terragrunt'
# Azure account name color.
typeset -g POWERLEVEL9K_AZURE_FOREGROUND=32 # POWERLEVEL9K_AZURE_CLASSES is an array with even number of elements. The first element
# in each pair defines a pattern against which the current AZURE subscription gets matched.
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# that gets matched. If you unset all POWERLEVEL9K_AZURE_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_AZURE_CLASSES defines the profile class. Patterns are tried in order. The
# first match wins.
#
# For example, given these settings:
#
# typeset -g POWERLEVEL9K_AZURE_CLASSES=(
# '*prod*' PROD
# '*test*' TEST
# '*' DEFAULT)
#
# If your current AZURE subscription is "company_test", its class is TEST
# because "company_test" doesn't match the pattern '*prod*' but does match '*test*'.
#
# You can define different colors, icons and content expansions for different classes:
#
# typeset -g POWERLEVEL9K_AZURE_TEST_FOREGROUND=28
# typeset -g POWERLEVEL9K_AZURE_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_AZURE_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
typeset -g POWERLEVEL9K_AZURE_CLASSES=(
# '*prod*' PROD # These values are examples that are unlikely
# '*test*' TEST # to match your needs. Customize them as needed.
'*' DEFAULT)
typeset -g POWERLEVEL9K_AZURE_DEFAULT_FOREGROUND=32
# Custom icon. # Custom icon.
# typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_AZURE_VISUAL_IDENTIFIER_EXPANSION='⭐'

View file

@ -4655,6 +4655,7 @@ prompt_azure() {
fi fi
local pat class state local pat class state
for pat class in "${_POWERLEVEL9K_AZURE_CLASSES[@]}"; do for pat class in "${_POWERLEVEL9K_AZURE_CLASSES[@]}"; do
name="${_p9k__cache_val[1]//\%/%%}"
if [[ $name == ${~pat} ]]; then if [[ $name == ${~pat} ]]; then
[[ -n $class ]] && state=_${${(U)class}//İ/I} [[ -n $class ]] && state=_${${(U)class}//İ/I}
break break