From 03ad58508a37f94a0239c5abf4d3112abba1f42a Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 10 Jan 2018 06:38:55 -0800 Subject: [PATCH] Don't show k8s segment for empty "current context" Fixes #122 --- fish_prompt.fish | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index d89fa3a..4ad3464 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -504,8 +504,11 @@ function __bobthefish_prompt_k8s_context -S -d 'Show current Kubernetes context' while read -l key val if [ "$key" = 'current-context:' ] + set -l context (string trim -c '"\' ' -- $val) + [ -z "$context" ]; and return + __bobthefish_start_segment $__color_k8s - echo -ns $val ' ' + echo -ns $context ' ' return end end < $file