speed up terraform, add classes to configs, bump version

pull/471/head
romkatv 5 years ago
parent ecc0157d94
commit f91597fe7b

@ -832,10 +832,35 @@
# typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
################[ terraform: terraform workspace (https://www.terraform.io) ]################# ################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color. # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=38 # in each pair defines a pattern against which the current terraform workspace gets matched.
# Custom icon. # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION='⭐' # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The
# first match wins.
#
# For example, given these settings:
#
# typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD
# '*test*' TEST
# '*' DEFAULT)
#
# If your current terraform workspace is "project_test", its class is TEST because "project_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_TERRAFORM_TEST_FOREGROUND=28
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD # These values are examples that are unlikely
# '*test*' TEST # to match your needs. Customize them as needed.
'*' DEFAULT)
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=38
# typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Show kubecontext only when the the command you are typing invokes one of these tools. # Show kubecontext only when the the command you are typing invokes one of these tools.
@ -934,7 +959,7 @@
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in # you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_AWS_CLASSES defines the context class. Patterns are tried in order. The # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The
# first match wins. # first match wins.
# #
# For example, given these settings: # For example, given these settings:

@ -898,10 +898,35 @@
# typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat '
################[ terraform: terraform workspace (https://www.terraform.io) ]################# ################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color. # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=4 # in each pair defines a pattern against which the current terraform workspace gets matched.
# Custom icon. # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION='⭐' # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The
# first match wins.
#
# For example, given these settings:
#
# typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD
# '*test*' TEST
# '*' DEFAULT)
#
# If your current terraform workspace is "project_test", its class is TEST because "project_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_TERRAFORM_TEST_FOREGROUND=2
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD # These values are examples that are unlikely
# '*test*' TEST # to match your needs. Customize them as needed.
'*' DEFAULT)
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=4
# typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]#
# Show aws only when the the command you are typing invokes one of these tools. # Show aws only when the the command you are typing invokes one of these tools.
@ -913,7 +938,7 @@
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in # you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_AWS_CLASSES defines the context class. Patterns are tried in order. The # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The
# first match wins. # first match wins.
# #
# For example, given these settings: # For example, given these settings:

@ -898,10 +898,35 @@
# typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat ' # typeset -g POWERLEVEL9K_KUBECONTEXT_PREFIX='%fat '
################[ terraform: terraform workspace (https://www.terraform.io) ]################# ################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color. # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element
typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=38 # in each pair defines a pattern against which the current terraform workspace gets matched.
# Custom icon. # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION='⭐' # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The
# first match wins.
#
# For example, given these settings:
#
# typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD
# '*test*' TEST
# '*' DEFAULT)
#
# If your current terraform workspace is "project_test", its class is TEST because "project_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_TERRAFORM_TEST_FOREGROUND=28
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD # These values are examples that are unlikely
# '*test*' TEST # to match your needs. Customize them as needed.
'*' DEFAULT)
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=38
# typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
#[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]# #[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]#
# Show aws only when the the command you are typing invokes one of these tools. # Show aws only when the the command you are typing invokes one of these tools.
@ -913,7 +938,7 @@
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in # you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_AWS_CLASSES defines the context class. Patterns are tried in order. The # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The
# first match wins. # first match wins.
# #
# For example, given these settings: # For example, given these settings:

@ -864,11 +864,36 @@
# typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_PLENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
################[ terraform: terraform workspace (https://www.terraform.io) ]################# ################[ terraform: terraform workspace (https://www.terraform.io) ]#################
# Terraform color. # POWERLEVEL9K_TERRAFORM_CLASSES is an array with even number of elements. The first element
# typeset -g POWERLEVEL9K_TERRAFORM_FOREGROUND=4 # in each pair defines a pattern against which the current terraform workspace gets matched.
# typeset -g POWERLEVEL9K_TERRAFORM_BACKGROUND=0 # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# Custom icon. # that gets matched. If you unset all POWERLEVEL9K_TERRAFORM_*CONTENT_EXPANSION parameters,
# typeset -g POWERLEVEL9K_TERRAFORM_VISUAL_IDENTIFIER_EXPANSION='⭐' # you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_TERRAFORM_CLASSES defines the workspace class. Patterns are tried in order. The
# first match wins.
#
# For example, given these settings:
#
# typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD
# '*test*' TEST
# '*' DEFAULT)
#
# If your current terraform workspace is "project_test", its class is TEST because "project_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_TERRAFORM_TEST_FOREGROUND=2
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_VISUAL_IDENTIFIER_EXPANSION='⭐'
# typeset -g POWERLEVEL9K_TERRAFORM_TEST_CONTENT_EXPANSION='> ${P9K_CONTENT} <'
typeset -g POWERLEVEL9K_TERRAFORM_CLASSES=(
# '*prod*' PROD # These values are examples that are unlikely
# '*test*' TEST # to match your needs. Customize them as needed.
'*' DEFAULT)
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=4
typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_BACKGROUND=0
# typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Show kubecontext only when the the command you are typing invokes one of these tools. # Show kubecontext only when the the command you are typing invokes one of these tools.
@ -969,7 +994,7 @@
# More specifically, it's P9K_CONTENT prior to the application of context expansion (see below) # More specifically, it's P9K_CONTENT prior to the application of context expansion (see below)
# that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters, # that gets matched. If you unset all POWERLEVEL9K_AWS_*CONTENT_EXPANSION parameters,
# you'll see this value in your prompt. The second element of each pair in # you'll see this value in your prompt. The second element of each pair in
# POWERLEVEL9K_AWS_CLASSES defines the context class. Patterns are tried in order. The # POWERLEVEL9K_AWS_CLASSES defines the profile class. Patterns are tried in order. The
# first match wins. # first match wins.
# #
# For example, given these settings: # For example, given these settings:

@ -209,6 +209,7 @@ function _p9k_read_word() {
_p9k_ret=${cached#*:} _p9k_ret=${cached#*:}
else else
local rest local rest
_p9k_ret=
{ read _p9k_ret rest <$1 } 2>/dev/null { read _p9k_ret rest <$1 } 2>/dev/null
_p9k__read_word_cache[$1]=$stat[1]:$_p9k_ret _p9k__read_word_cache[$1]=$stat[1]:$_p9k_ret
fi fi
@ -4298,14 +4299,11 @@ function instant_prompt_nix_shell() {
} }
function prompt_terraform() { function prompt_terraform() {
local ws=default local ws=$TF_WORKSPACE
if [[ -n $TF_WORKSPACE ]]; then if [[ -z $TF_WORKSPACE ]]; then
ws=$TF_WORKSPACE _p9k_read_word ${${TF_DATA_DIR:-.terraform}:A}/environment && ws=$_p9k_ret
else
local f=${TF_DATA_DIR:-.terraform}/environment
[[ -r $f ]] && _p9k_read_file $f && ws=$_p9k_ret
fi fi
ws=${${ws##[[:space:]]#}%%[[:space:]]#} [[ $ws == (|default) ]] && return
local pat class local pat class
for pat class in "${_POWERLEVEL9K_TERRAFORM_CLASSES[@]}"; do for pat class in "${_POWERLEVEL9K_TERRAFORM_CLASSES[@]}"; do
if [[ $ws == ${~pat} ]]; then if [[ $ws == ${~pat} ]]; then
@ -4313,7 +4311,7 @@ function prompt_terraform() {
break break
fi fi
done done
[[ $ws == default ]] || _p9k_prompt_segment "$0$state" $_p9k_color1 blue TERRAFORM_ICON 0 '' $ws _p9k_prompt_segment "$0$state" $_p9k_color1 blue TERRAFORM_ICON 0 '' $ws
} }
_p9k_prompt_terraform_init() { _p9k_prompt_terraform_init() {
@ -6457,7 +6455,7 @@ _p9k_must_init() {
[[ $sig == $_p9k__param_sig ]] && return 1 [[ $sig == $_p9k__param_sig ]] && return 1
_p9k_deinit _p9k_deinit
fi fi
_p9k__param_pat=$'v32\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1' _p9k__param_pat=$'v33\1'${ZSH_VERSION}$'\1'${ZSH_PATCHLEVEL}$'\1'
_p9k__param_pat+=$'${#parameters[(I)POWERLEVEL9K_*]}\1${(%):-%n%#}\1$GITSTATUS_LOG_LEVEL\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+=$'$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' _p9k__param_pat+=$'$DEFAULT_USER\1${ZLE_RPROMPT_INDENT:-1}\1$P9K_SSH\1$__p9k_ksh_arrays'

Loading…
Cancel
Save