Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Hide kubecontext outside of kube project #122

Merged
merged 3 commits into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions functions/__sf_section_kubecontext.fish
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function __sf_section_kubecontext -d "Display the kubernetes context"
type -q kubectl; or return

set -l kube_context (kubectl config current-context ^/dev/null)
[ -z $kube_context ]; and return

__sf_lib_section \
$SPACEFISH_KUBECONTEXT_COLOR \
Expand Down
6 changes: 6 additions & 0 deletions tests/__sf_section_kubecontext.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ test "Prints section"
) = (__sf_section_kubecontext)
end

test "Kubecontext symbol does not appear outside of a Kubernetes project"
(
mock kubectl 1
) = (__sf_section_kubecontext)
end

test "Changing SPACEFISH_KUBECONTEXT_SYMBOL changes the displayed character"
(
set SPACEFISH_KUBECONTEXT_SYMBOL "· "
Expand Down