Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add terraform workspace prompt #322

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions bullet-train.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if [ ! -n "${BULLETTRAIN_PROMPT_ORDER+1}" ]; then
elixir
git
hg
terraform
cmd_exec_time
)
fi
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down