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

make terraform_version compatible with tfenv (#2049)

This commit is contained in:
Roman Perepelitsa 2023-10-23 10:44:15 +02:00
parent c7fa7d6748
commit 430616734a

View file

@ -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() {