Files
dotfiles/.zsh/theme/functions/kubernetes.zsh
2024-10-30 12:37:58 +01:00

10 lines
352 B
Bash

function get_kubectl_context() {
if (( $+commands[kubectl] )); then
local context=$(kubectl config current-context 2>/dev/null)
local namespace=$(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
if [[ -n "$context" ]]; then
echo "%F{blue}⎈ $context:$namespace%f"
fi
fi
}