mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 12:03:33 +00:00
refactor: GetContextOverrideOrCurrent to check if config used
This commit is contained in:
+6
-4
@@ -72,11 +72,13 @@ func (cli *CLI) SetCurrentContext(name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cli *CLI) GetContextOverrideOrCurrent() string {
|
func (cli *CLI) GetContextOverrideOrCurrent() string {
|
||||||
contextName := cli.contextOverride
|
if cli.contextOverride != "" {
|
||||||
if contextName == "" {
|
return cli.contextOverride
|
||||||
contextName = cli.Config.CurrentContext
|
|
||||||
}
|
}
|
||||||
return contextName
|
if cli.Config != nil {
|
||||||
|
return cli.Config.CurrentContext
|
||||||
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConnectCluster connects to a cluster using the context override or the current context if not specified.
|
// ConnectCluster connects to a cluster using the context override or the current context if not specified.
|
||||||
|
|||||||
Reference in New Issue
Block a user