Improve formatting of Terraform plugin output
Improves the formatting of the Terraform plugin's `tf_prompt_info()` function (see #6373 and #6418). It: - adds a `tf:` prefix to indicate that what follows is the Terraform workspace - adds colorization and formatting to make the appearance more similar to the `git-prompt` plugin - adds a trailing space to separate the prompt from user input
This commit is contained in:
parent
e273cf004e
commit
288e596566
@ -1,7 +1,10 @@
|
|||||||
function tf_prompt_info() {
|
function tf_prompt_info() {
|
||||||
|
RESET="%{${reset_color}%}"
|
||||||
|
|
||||||
# check if in terraform dir
|
# check if in terraform dir
|
||||||
if [ -d .terraform ]; then
|
if [ -d .terraform ]; then
|
||||||
workspace=$(terraform workspace show 2> /dev/null) || return
|
workspace=$(terraform workspace show 2> /dev/null) || return
|
||||||
echo "[${workspace}]"
|
TF_INFO="$RESET%{$fg_bold[blue]%}tf:(%{$fg_bold[magenta]%}$workspace%{$fg_bold[blue]%})$RESET "
|
||||||
|
echo "$TF_INFO"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user