Add terraform workspace to prompt
This commit is contained in:
@@ -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)
|
||||
* `scm` - Version control information, `git`
|
||||
* `user_info` - Current user
|
||||
* `terraform` - Current terraform workspace
|
||||
* `wd` - Working directory, like `cwd` but doesn't show the full folder
|
||||
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
|
||||
|
||||
@@ -41,6 +41,15 @@ function __powerline_user_info_prompt {
|
||||
[[ -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 {
|
||||
local node_version=""
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
|
||||
RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161}
|
||||
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_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user