mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-12 08:57:48 +00:00
18 lines
429 B
Go
18 lines
429 B
Go
package kubeconfig
|
|
|
|
// GetCurrentContext returns "current-context" value in given
|
|
// kubeconfig object Node, or returns "" if not found.
|
|
func (k *Kubeconfig) GetCurrentContext() string {
|
|
v := valueOf(k.rootNode, "current-context")
|
|
if v == nil {
|
|
return ""
|
|
}
|
|
return v.Value
|
|
}
|
|
|
|
func (k *Kubeconfig) UnsetCurrentContext() error {
|
|
curCtxValNode := valueOf(k.rootNode, "current-context")
|
|
curCtxValNode.Value = ""
|
|
return nil
|
|
}
|