From 288e596566774fae05df9eb89b4a4c6b8b781b67 Mon Sep 17 00:00:00 2001 From: Chris Belyea Date: Fri, 17 Nov 2017 09:27:15 -0500 Subject: [PATCH] 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 --- plugins/terraform/terraform.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh index b170f73a..f768a123 100644 --- a/plugins/terraform/terraform.plugin.zsh +++ b/plugins/terraform/terraform.plugin.zsh @@ -1,7 +1,10 @@ function tf_prompt_info() { + RESET="%{${reset_color}%}" + # check if in terraform dir if [ -d .terraform ]; then 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 }