Skip to content

Instantly share code, notes, and snippets.

@vuldin
Created July 11, 2021 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vuldin/52758cc11b12a4f2f1c41f0f69913398 to your computer and use it in GitHub Desktop.
Save vuldin/52758cc11b12a4f2f1c41f0f69913398 to your computer and use it in GitHub Desktop.
shorten context display within kube_ps1 prompt if it is too long
# Context
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
KUBE_PS1_CONTEXT=$(echo $KUBE_PS1_CONTEXT | sed -E "s/(.{15}).*$/\1.../")
KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_CTX_COLOR)${KUBE_PS1_CONTEXT}${KUBE_PS1_RESET_COLOR}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment