From 864a50c42e73e87c59b3fc6ff0891ea0fec12b46 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Thu, 13 Aug 2020 18:15:12 -0700 Subject: [PATCH] Move Kubernetes prompt color into a function --- functions/__bobthefish_prompt_k8s_color.fish | 5 +++++ functions/fish_prompt.fish | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 functions/__bobthefish_prompt_k8s_color.fish diff --git a/functions/__bobthefish_prompt_k8s_color.fish b/functions/__bobthefish_prompt_k8s_color.fish new file mode 100644 index 0000000..02871d1 --- /dev/null +++ b/functions/__bobthefish_prompt_k8s_color.fish @@ -0,0 +1,5 @@ +function __bobthefish_prompt_k8s_color -S -d 'Determine Kubernetes prompt color based on the current context and namespace' + for i in $color_k8s + echo $i + end +end diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 02bfe97..cee8b61 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -645,11 +645,10 @@ function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context' [ -n "$namespace" ] and set segment $segment ':' $namespace - __bobthefish_start_segment $color_k8s + __bobthefish_start_segment (__bobthefish_prompt_k8s_color $context $namespace) echo -ns $segment ' ' end - # ============================== # Cloud Tools # ==============================