mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
fix: handle kubectl context unset
This commit is contained in:
parent
0ba62540ab
commit
1339048fb4
|
@ -20,5 +20,5 @@ func (k *kubectl) enabled() bool {
|
|||
return false
|
||||
}
|
||||
k.contextName, _ = k.env.runCommand("kubectl", "config", "current-context")
|
||||
return true
|
||||
return k.contextName != ""
|
||||
}
|
||||
|
|
|
@ -40,3 +40,12 @@ func TestKubectlEnabled(t *testing.T) {
|
|||
assert.True(t, kubectl.enabled())
|
||||
assert.Equal(t, expected, kubectl.string())
|
||||
}
|
||||
|
||||
func TestKubectlNoContext(t *testing.T) {
|
||||
args := &kubectlArgs{
|
||||
enabled: true,
|
||||
contextName: "",
|
||||
}
|
||||
kubectl := bootStrapKubectlTest(args)
|
||||
assert.False(t, kubectl.enabled())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue