From 2a6f07b065467d87dbf839fc1a77744744d2d417 Mon Sep 17 00:00:00 2001 From: guillaume Date: Wed, 2 Aug 2023 23:55:48 +0200 Subject: [PATCH] Actualiser p10k.zsh Ajout du context docker avec prompt_docker --- p10k.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/p10k.zsh b/p10k.zsh index 4cae900..6f3e9da 100644 --- a/p10k.zsh +++ b/p10k.zsh @@ -78,6 +78,7 @@ scalaenv # scala version from scalaenv (https://github.com/scalaenv/scalaenv) haskell_stack # haskell version from stack (https://haskellstack.org/) kubecontext # current kubernetes context (https://kubernetes.io/) + docker # current docker context terraform # terraform workspace (https://www.terraform.io) # terraform_version # terraform version (https://www.terraform.io) aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) @@ -187,6 +188,18 @@ # Left prompt terminator for lines without any segments. typeset -g POWERLEVEL9K_EMPTY_LINE_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL= + #################################[ prompt_docker: docker context ]################################## + # Prompt personnalisé pour Docker + function prompt_docker() { + local context=$(docker context show) + if [[ "$context" != "default" ]]; then + p10k segment -f 208 -t "%F{cyan} :$context%f" + elif docker info &>/dev/null; then + p10k segment -f 208 -t "%F{cyan}%f" + fi + } + typeset -g POWERLEVEL9K_DOCKER_SHOW_ON_COMMAND='docker' + #################################[ os_icon: os identifier ]################################## # OS identifier color. typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND=255