feat(terraform): add PREFIX and SUFFIX settings to `tf_prompt_info` (#8605)
Closes #8605
Diff
1diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh
2index 997241c9aec6d40ec8f49b5e2e927908c67af56b..86b12751cca007f35144a70c9f69ebe88344dbc6 100644
3--- a/plugins/terraform/terraform.plugin.zsh
4+++ b/plugins/terraform/terraform.plugin.zsh
5@@ -1,11 +1,11 @@
6 function tf_prompt_info() {
7- # dont show 'default' workspace in home dir
8- [[ "$PWD" == ~ ]] && return
9- # check if in terraform dir
10- if [[ -d .terraform && -r .terraform/environment ]]; then
11- workspace=$(cat .terraform/environment) || return
12- echo "[${workspace}]"
13- fi
14+ # dont show 'default' workspace in home dir
15+ [[ "$PWD" != ~ ]] || return
16+ # check if in terraform dir and file exists
17+ [[ -d .terraform && -r .terraform/environment ]] || return
18+
19+ local workspace="$(< .terraform/environment)"
20+ echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}"
21 }
2223 alias tf='terraform'