Add terraform workspace to prompt

pull/1508/head
Ofir Shtrull 2020-02-27 14:40:57 +02:00
parent 223398c9e8
commit 78397ad598
9 changed files with 26 additions and 0 deletions

View File

@ -66,6 +66,8 @@ The contents of both prompt sides can be "reordered", all the "segments" (every
* `ruby` - Current ruby version if using `rvm` * `ruby` - Current ruby version if using `rvm`
* `node` - Current node version (only `nvm` is supported) * `node` - Current node version (only `nvm` is supported)
* `scm` - Version control information, `git` * `scm` - Version control information, `git`
* `terraform` - Current terraform workspace
* `k8s_context` - Show current kubernetes context
* `user_info` - Current user * `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder * `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in. hierarchy, only the directory you're currently in.

View File

@ -49,6 +49,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161} RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161}
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="r "} RUBY_CHAR=${POWERLINE_RUBY_CHAR:="r "}
TERRAFORM_THEME_PROMPT_COLOR=${POWERLINE_TERRAFORM_COLOR:=161}
TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}

View File

@ -60,6 +60,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* `ruby` - Current ruby version if using `rvm` * `ruby` - Current ruby version if using `rvm`
* `node` - Current node version (only `nvm` is supported) * `node` - Current node version (only `nvm` is supported)
* `scm` - Version control information, `git` * `scm` - Version control information, `git`
* `terraform` - Current terraform workspace
* `user_info` - Current user * `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder * `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in. hierarchy, only the directory you're currently in.

View File

@ -47,6 +47,9 @@ RUBY_CHAR=${POWERLINE_RUBY_CHAR:="r "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
TERRAFORM_THEME_PROMPT_COLOR=${POWERLINE_TERRAFORM_COLOR:=161}
TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "} AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}

View File

@ -52,6 +52,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* `hostname` - Host name of machine * `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim * `in_vim` - Show identifier if running in `:terminal` from vim
* `k8s_context` - Show current kubernetes context * `k8s_context` - Show current kubernetes context
* `terraform` - Current terraform workspace
* `last_status` - Exit status of last run command * `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv` * `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported) and `conda` supported)

View File

@ -43,6 +43,9 @@ RUBY_CHAR=${POWERLINE_RUBY_CHAR:="💎 "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
TERRAFORM_THEME_PROMPT_COLOR=${POWERLINE_TERRAFORM_COLOR:=161}
TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "} AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}

View File

@ -67,6 +67,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* `node` - Current node version (only `nvm` is supported) * `node` - Current node version (only `nvm` is supported)
* `scm` - Version control information, `git` * `scm` - Version control information, `git`
* `user_info` - Current user * `user_info` - Current user
* `terraform` - Current terraform workspace
* `wd` - Working directory, like `cwd` but doesn't show the full folder * `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in. hierarchy, only the directory you're currently in.
* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell * `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell

View File

@ -41,6 +41,15 @@ function __powerline_user_info_prompt {
[[ -n "${user_info}" ]] && echo "${user_info}|${color}" [[ -n "${user_info}" ]] && echo "${user_info}|${color}"
} }
function __powerline_terraform_prompt() {
local terraform_workspace=""
if [ -d .terraform ]; then
terraform_workspace="$(command terraform workspace show 2>/dev/null)"
[[ -n "${terraform_workspace}" ]] && echo "${TERRAFORM_CHAR}${terraform_workspace}|${TERRAFORM_THEME_PROMPT_COLOR}"
fi
}
function __powerline_node_prompt { function __powerline_node_prompt {
local node_version="" local node_version=""

View File

@ -45,6 +45,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161} RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161}
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="r "} RUBY_CHAR=${POWERLINE_RUBY_CHAR:="r "}
TERRAFORM_THEME_PROMPT_COLOR=${POWERLINE_TERRAFORM_COLOR:=161}
TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}