Skip to content

Instantly share code, notes, and snippets.

@vknabel
Last active May 27, 2024 06:05
Show Gist options
  • Save vknabel/24b9d6720c3bc5a193fa7ba6a4d81b0d to your computer and use it in GitHub Desktop.
Save vknabel/24b9d6720c3bc5a193fa7ba6a4d81b0d to your computer and use it in GitHub Desktop.
powerlevel10k prompts for metal, metalctl and cloudctl contexts
function prompt_metal_ctx() {
p10k segment -f white -t "$(metal ctx show-current)"
}
function prompt_metalctl_ctx() {
p10k segment -f white -t "$(metalctl ctx short)"
}
function prompt_cloudctl_ctx() {
p10k segment -f white -t "$(cloudctl ctx short)"
}
() {
# Left prompt segments.
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
# ...
metal_ctx
metalctl_ctx
cloudctl_ctx
# ...
)
typeset -g POWERLEVEL9K_METAL_CTX_SHOW_ON_COMMAND='metal'
typeset -g POWERLEVEL9K_METALCTL_CTX_SHOW_ON_COMMAND='metalctl'
typeset -g POWERLEVEL9K_CLOUDCTL_CTX_SHOW_ON_COMMAND='cloudctl'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment