Add kubernetes-context segment to powerline

pull/1270/head
Jeremy Mathevet 2018-11-13 11:25:59 +00:00
parent a8ee759293
commit 7e26ae28bf
No known key found for this signature in database
GPG Key ID: 4E97E2E40EBEEF42
8 changed files with 32 additions and 3 deletions

View File

@ -336,6 +336,10 @@ function ruby_version_prompt {
echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)$(chruby_version_prompt)"
}
function k8s_context_prompt {
echo -e "$(kubectl config current-context)"
}
function virtualenv_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then
virtualenv=`basename "$VIRTUAL_ENV"`

View File

@ -14,6 +14,7 @@ A colorful theme, where shows a lot information about your shell session.
* An indicator when the current shell is inside the Vim editor
* Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin))
* SCM Repository status (e.g. Git, SVN)
* The current Kubernetes environment
* The current Python environment (Virtualenv, venv, and Conda are supported) in use
* The current Ruby environment (rvm and rbenv are supported) in use
* Last command exit code (only shown when the exit code is greater than 0)
@ -48,11 +49,12 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
* `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim
* `k8s_context` - Show current kubernetes context
* `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported)
* `ruby` - Current ruby version if using `rvm`
* `scm` - Version control information, `git`
* `scm` - Version control information, `git`
* `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in.

View File

@ -33,6 +33,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
RUBY_THEME_PROMPT_COLOR=161
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="r "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26
AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=aws }"
AWS_PROFILE_PROMPT_COLOR=208

View File

@ -12,6 +12,7 @@ A colorful theme, where shows a lot information about your shell session.
* An indicator when the current shell is inside the Vim editor
* Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin))
* SCM Repository status (e.g. Git, SVN)
* The current Kubernetes environment
* The current Python environment (Virtualenv, venv, and Conda are supported) in use
* The current Ruby environment (rvm and rbenv are supported) in use
* Last command exit code (only shown when the exit code is greater than 0)
@ -46,11 +47,12 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
* `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim
* `k8s_context` - Show current kubernetes context
* `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported)
* `ruby` - Current ruby version if using `rvm`
* `scm` - Version control information, `git`
* `scm` - Version control information, `git`
* `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in.

View File

@ -28,6 +28,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
RUBY_THEME_PROMPT_COLOR=161
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="💎 "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26
AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=aws }"
AWS_PROFILE_PROMPT_COLOR=208

View File

@ -16,6 +16,7 @@ A colorful theme, where shows a lot information about your shell session.
* An indicator when the current shell is inside the Vim editor
* Battery charging status (depends on the [../../plugins/available/battery.plugin.bash](battery plugin))
* SCM Repository status (e.g. Git, SVN)
* The current Kubernetes environment
* The current Python environment (Virtualenv, venv, and Conda are supported) in use
* The current Ruby environment (rvm and rbenv are supported) in use
* Last command exit code (only shown when the exit code is greater than 0)
@ -50,11 +51,12 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
* `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim
* `k8s_context` - Show current kubernetes context
* `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported)
* `ruby` - Current ruby version if using `rvm`
* `scm` - Version control information, `git`
* `scm` - Version control information, `git`
* `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in.

View File

@ -52,6 +52,16 @@ function __powerline_ruby_prompt {
[[ -n "${ruby_version}" ]] && echo "${RUBY_CHAR}${ruby_version}|${RUBY_THEME_PROMPT_COLOR}"
}
function __powerline_k8s_context_prompt {
local kubernetes_context=""
if _command_exists kubectl; then
kubernetes_context="$(k8s_context_prompt)"
fi
[[ -n "${kubernetes_context}" ]] && echo "${KUBERNETES_CONTEXT_THEME_CHAR}${kubernetes_context}|${KUBERNETES_CONTEXT_THEME_PROMPT_COLOR}"
}
function __powerline_python_venv_prompt {
set +u
local python_venv=""

View File

@ -31,6 +31,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
RUBY_THEME_PROMPT_COLOR=161
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="r "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26
AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=aws }"
AWS_PROFILE_PROMPT_COLOR=208