Skip to content

Commit

Permalink
make terraform_version compatible with tfenv (#2049)
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Oct 23, 2023
1 parent c7fa7d6 commit 4306167
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/p10k.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5021,12 +5021,16 @@ _p9k_prompt_terraform_init() {
}

function prompt_terraform_version() {
_p9k_cached_cmd 0 '' terraform --version || return
local v=${_p9k__ret#Terraform v}
(( $#v < $#_p9k__ret )) || return
v=${v%%$'\n'*}
local v cfg terraform=${commands[terraform]}
_p9k_upglob .terraform-version -. || cfg=$_p9k__parent_dirs[$?]/.terraform-version
if _p9k_cache_stat_get $0.$TFENV_TERRAFORM_VERSION $terraform $cfg; then
v=$_p9k__cache_val[1]
else
v=${${"$(terraform --version 2>/dev/null)"#Terraform v}%%$'\n'*} || v=
_p9k_cache_stat_set "$v"
fi
[[ -n $v ]] || return
_p9k_prompt_segment $0 $_p9k_color1 blue TERRAFORM_ICON 0 '' $v
_p9k_prompt_segment $0 $_p9k_color1 blue TERRAFORM_ICON 0 '' ${v//\%/%%}
}

_p9k_prompt_terraform_version_init() {
Expand Down

0 comments on commit 4306167

Please sign in to comment.