From 2a3eaeaa1a44623fc6057e70eb621b8014c63658 Mon Sep 17 00:00:00 2001 From: Ovidiu-Florin BOGDAN Date: Mon, 23 Mar 2020 14:10:26 +0200 Subject: [PATCH 1/2] Add terraform workspace prompt --- bullet-train.zsh-theme | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index d72c4f5..a1cc23f 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -34,6 +34,7 @@ if [ ! -n "${BULLETTRAIN_PROMPT_ORDER+1}" ]; then elixir git hg + terraform cmd_exec_time ) fi @@ -330,6 +331,16 @@ if [ ! -n "${BULLETTRAIN_EXEC_TIME_FG+1}" ]; then BULLETTRAIN_EXEC_TIME_FG=black fi +# TERRAFORM +if [ ! -n "${BULLETTRAIN_TERRAFORM_BG+1}" ]; then + BULLETTRAIN_TERRAFORM_BG=magenta +fi +if [ ! -n "${BULLETTRAIN_TERRAFORM_FG+1}" ]; then + BULLETTRAIN_TERRAFORM_FG=white +fi +if [ ! -n "${BULLETTRAIN_TERRAFORM_PREFIX+1}" ]; then + BULLETTRAIN_TERRAFORM_PREFIX="♦" +fi # ------------------------------------------------------------------------------ # SEGMENT DRAWING @@ -608,6 +619,13 @@ prompt_aws() { fi } +prompt_terraform() { + local workspace="$(tf_prompt_info || echo '')" + if [[ -n "$workspace" ]]; then + prompt_segment $BULLETTRAIN_TERRAFORM_BG $BULLETTRAIN_TERRAFORM_FG "$BULLETTRAIN_TERRAFORM_PREFIX $workspace" + fi +} + # SCREEN Session prompt_screen() { local session_name="$STY" From a8a51dcf4b935b66edf6bcec2c9a08f189a6e173 Mon Sep 17 00:00:00 2001 From: Ovidiu-Florin BOGDAN Date: Mon, 23 Mar 2020 14:16:53 +0200 Subject: [PATCH 2/2] Update Readme --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42c44ee..1d64165 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,6 @@ If `BULLETTRAIN_KCTX_KUBECTL=false` or `kubectl` is not installed, `BULLETTRAIN_ The usage of `kubectl` allow the prompt to get the default namespace even if you are using multiple kube config files (e.g. KUBECONFIG=~/.kube/config:path-to-config1:path-to-config2) - ### AWS Profile Displays which AWS (Amazon Web Services) credentials profile is currently set. @@ -258,6 +257,14 @@ This environment var is used by aws-cli and other tools to use the right access The git prompt can be disabled for a specific repository by setting a git config flag: `git config oh-my-zsh.hide-status 1`. This is useful to avoid performance issues for particularly huge repositories. +### Terraform + +|Variable|Default|Meaning +|--------|-------|-------| +|`BULLETTRAIN_TERRAFORM_BG`|`magenta`|Background color +|`BULLETTRAIN_TERRAFORM_FG`|`white`|Foreground color +|`BULLETTRAIN_TERRAFORM_PREFIX`|`"♦"`|Prefix + ### Screen |Variable|Default|Meaning