aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh14
1 files changed, 9 insertions, 5 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index dbc69c41..09985e0b 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -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() {