MCPcopy
hub / github.com/derailed/k9s / CurrentContextName

Method CurrentContextName

internal/client/config.go:156–166  ·  view source on GitHub ↗

CurrentContextName returns the currently active config context.

()

Source from the content-addressed store, hash-verified

154
155// CurrentContextName returns the currently active config context.
156func (c *Config) CurrentContextName() (string, error) {
157 if isSet(c.flags.Context) {
158 return *c.flags.Context, nil
159 }
160 cfg, err := c.RawConfig()
161 if err != nil {
162 return "", fmt.Errorf("fail to load rawConfig: %w", err)
163 }
164
165 return cfg.CurrentContext, nil
166}
167
168func (c *Config) CurrentContextNamespace() (string, error) {
169 name, err := c.CurrentContextName()

Callers 6

TestConfigCurrentContextFunction · 0.95
TestConfigSwitchContextFunction · 0.95
CloneMethod · 0.95
CurrentContextMethod · 0.95
RenameContextMethod · 0.95

Calls 2

RawConfigMethod · 0.95
isSetFunction · 0.85

Tested by 2

TestConfigCurrentContextFunction · 0.76
TestConfigSwitchContextFunction · 0.76