From 882cede0aec99f58ccaf8d0765688bfee7b198fb Mon Sep 17 00:00:00 2001 From: Andrea Carpani Date: Fri, 3 Jul 2020 19:05:48 +0200 Subject: [PATCH] Add option to show terraform workspace even if it's default --- config/p10k-classic.zsh | 2 ++ config/p10k-lean-8colors.zsh | 2 ++ config/p10k-lean.zsh | 2 ++ config/p10k-rainbow.zsh | 2 ++ internal/p10k.zsh | 4 +++- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 9e85288..b6a72f6 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -1153,6 +1153,8 @@ '*' DEFAULT) typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=38 # typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' + # Show terraform workspace even if it's default + typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT_WS=false #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index cac63a9..6c27bca 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -1217,6 +1217,8 @@ '*' DEFAULT) typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=4 # typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' + # Show terraform workspace even if it's default + typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT_WS=false #[ 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. diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 747bd86..cdca774 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -1217,6 +1217,8 @@ '*' DEFAULT) typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=38 # typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' + # Show terraform workspace even if it's default + typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT_WS=false #[ 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. diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 9e91db6..2a7fd63 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -1216,6 +1216,8 @@ typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_FOREGROUND=4 typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_BACKGROUND=0 # typeset -g POWERLEVEL9K_TERRAFORM_DEFAULT_VISUAL_IDENTIFIER_EXPANSION='⭐' + # Show terraform workspace even if it's default + typeset -g POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT_WS=false #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the the command you are typing invokes one of these tools. diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 962ebd4..095ad31 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4666,7 +4666,8 @@ function prompt_terraform() { if [[ -z $TF_WORKSPACE ]]; then _p9k_read_word ${${TF_DATA_DIR:-.terraform}:A}/environment && ws=$_p9k__ret fi - [[ $ws == (|default) ]] && return + [[ $ws == '' ]] && return + [[ ($ws == 'default') && ( ! ${_POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT_WS} ) ]] && return local pat class for pat class in "${_POWERLEVEL9K_TERRAFORM_CLASSES[@]}"; do if [[ $ws == ${~pat} ]]; then @@ -7114,6 +7115,7 @@ _p9k_init_params() { _p9k_declare -a POWERLEVEL9K_KUBECONTEXT_CLASSES -- _p9k_declare -a POWERLEVEL9K_AWS_CLASSES -- _p9k_declare -a POWERLEVEL9K_TERRAFORM_CLASSES -- + _p9k_declare -b POWERLEVEL9K_TERRAFORM_SHOW_DEFAULT_WS 0 _p9k_declare -a POWERLEVEL9K_GOOGLE_APP_CRED_CLASSES -- 'service_account:*' SERVICE_ACCOUNT # Specifies the format of java version. #