mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
25 lines
449 B
Go
25 lines
449 B
Go
|
package main
|
||
|
|
||
|
type kubectl struct {
|
||
|
props *properties
|
||
|
env environmentInfo
|
||
|
contextName string
|
||
|
}
|
||
|
|
||
|
func (k *kubectl) string() string {
|
||
|
return k.contextName
|
||
|
}
|
||
|
|
||
|
func (k *kubectl) init(props *properties, env environmentInfo) {
|
||
|
k.props = props
|
||
|
k.env = env
|
||
|
}
|
||
|
|
||
|
func (k *kubectl) enabled() bool {
|
||
|
if !k.env.hasCommand("kubectl") {
|
||
|
return false
|
||
|
}
|
||
|
k.contextName = k.env.runCommand("kubectl", "config", "current-context")
|
||
|
return true
|
||
|
}
|