CurrentContextName returns the currently active config context.
()
| 154 | |
| 155 | // CurrentContextName returns the currently active config context. |
| 156 | func (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 | |
| 168 | func (c *Config) CurrentContextNamespace() (string, error) { |
| 169 | name, err := c.CurrentContextName() |