chris-marsh / pureline

A Pure Bash Powerline PS1 Command Prompt
MIT License
501 stars 94 forks source link

Kubernetes segment spams "error: current-context is not set" if kubectl available but not configured yet #65

Open darkvertex opened 3 years ago

darkvertex commented 3 years ago

When the command exists but kubernetes has no context currently configured, kubectl config current-context prints error: current-context is not set into the stderr.

It's annoying and can be bypassed by disabling the Kubernetes segment temporarily HOWEVER I think it may be worth fixing here: https://github.com/chris-marsh/pureline/blob/main/segments/kubernetes_segment#L12 and changing it for:

        local context=$(kubectl config current-context 2>/dev/null)

to silence the stderr (because you have the exit code and stdout will be empty when not set, so it's superfluous.)

chris-marsh commented 3 years ago

Thanks for the report and fix. I'll include it soon.