oh-my-zsh/plugins/terraform/terraform.plugin.zsh
Chris Belyea 288e596566
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
2017-11-17 09:27:15 -05:00

11 lines
323 B
Bash

function tf_prompt_info() {
RESET="%{${reset_color}%}"
# check if in terraform dir
if [ -d .terraform ]; then
workspace=$(terraform workspace show 2> /dev/null) || return
TF_INFO="$RESET%{$fg_bold[blue]%}tf:(%{$fg_bold[magenta]%}$workspace%{$fg_bold[blue]%})$RESET "
echo "$TF_INFO"
fi
}