add availability to display or not Terraform version

Show Terraform version segment only when *.tf files are present in current directory
pull/1541/head
Patrick Tavares 3 years ago
parent 32e76e7721
commit 20b87731de

@ -1206,6 +1206,8 @@
# typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ terraform_version: terraform version (https://www.terraform.io) ]############## #############[ terraform_version: terraform version (https://www.terraform.io) ]##############
# Don't show terraform version if there is no "*.tf" files
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_ALWAYS=false
# Terraform version color. # Terraform version color.
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38 typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38
# Custom icon. # Custom icon.

@ -1274,6 +1274,8 @@
# typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ terraform_version: terraform version (https://www.terraform.io) ]############## #############[ terraform_version: terraform version (https://www.terraform.io) ]##############
# Don't show terraform version if there is no "*.tf" files
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_ALWAYS=false
# Terraform version color. # Terraform version color.
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=4 typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=4
# Custom icon. # Custom icon.

@ -1270,6 +1270,8 @@
# typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ terraform_version: terraform version (https://www.terraform.io) ]############## #############[ terraform_version: terraform version (https://www.terraform.io) ]##############
# Don't show terraform version if there is no "*.tf" files
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_ALWAYS=false
# Terraform version color. # Terraform version color.
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38 typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=38
# Custom icon. # Custom icon.

@ -1273,6 +1273,8 @@
# typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐'
#############[ terraform_version: terraform version (https://www.terraform.io) ]############## #############[ terraform_version: terraform version (https://www.terraform.io) ]##############
# Don't show terraform version if there is no "*.tf" files
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_ALWAYS=false
# Terraform version color. # Terraform version color.
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=4 typeset -g POWERLEVEL9K_TERRAFORM_VERSION_FOREGROUND=4
typeset -g POWERLEVEL9K_TERRAFORM_VERSION_BACKGROUND=0 typeset -g POWERLEVEL9K_TERRAFORM_VERSION_BACKGROUND=0

@ -3,7 +3,7 @@ if [[ $__p9k_sourced != 13 ]]; then
>&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation." >&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation."
>&2 print -P "" >&2 print -P ""
if (( ${+functions[antigen]} )); then if (( ${+functions[antigen]} )); then
>&2 print -P "If using %Bantigen%b, run the folowing command to fix:" >&2 print -P "If using %Bantigen%b, run the following command to fix:"
>&2 print -P "" >&2 print -P ""
>&2 print -P " %F{2}antigen%f reset" >&2 print -P " %F{2}antigen%f reset"
if [[ -d ~/.antigen ]]; then if [[ -d ~/.antigen ]]; then
@ -4888,6 +4888,9 @@ _p9k_prompt_terraform_init() {
} }
function prompt_terraform_version() { function prompt_terraform_version() {
if [[ $_POWERLEVEL9K_TERRAFORM_VERSION_ALWAYS ]]; then
_p9k_upglob "*.tf" && return 1
fi
_p9k_cached_cmd 0 '' terraform --version || return _p9k_cached_cmd 0 '' terraform --version || return
local v=${_p9k__ret#Terraform v} local v=${_p9k__ret#Terraform v}
(( $#v < $#_p9k__ret )) || return (( $#v < $#_p9k__ret )) || return

Loading…
Cancel
Save