Created
August 18, 2016 13:21
-
-
Save roccozanni/200ef1d1695bbdee585625b5b2cb3278 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt_kubectl() | |
{ | |
# Exit if kubectl is not configured | |
local kubectl_config="$HOME/.kube/config" | |
if [[ ! -a "$kubectl_config" ]]; then | |
return | |
fi | |
# Get current context | |
local kubectl_context=$(cat $kubectl_config | grep "current-context:" | sed "s/current-context: //") | |
if [[ -n $kubectl_context ]]; then | |
prompt_segment magenta black "K:$kubectl_context" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this! I've made a few modifications.