|
@@ -212,6 +212,12 @@ func (c *CLIConfig) SetHost(host string) error {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *CLIConfig) SetProject(projectID uint) error {
|
|
func (c *CLIConfig) SetProject(projectID uint) error {
|
|
|
|
|
+ if config.Kubeconfig != "" || viper.IsSet("kubeconfig") {
|
|
|
|
|
+ viper.Set("kubeconfig", "")
|
|
|
|
|
+ color.New(color.FgBlue).Println("Removing local kubeconfig")
|
|
|
|
|
+ config.Kubeconfig = ""
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
viper.Set("project", projectID)
|
|
viper.Set("project", projectID)
|
|
|
color.New(color.FgGreen).Printf("Set the current project as %d\n", projectID)
|
|
color.New(color.FgGreen).Printf("Set the current project as %d\n", projectID)
|
|
|
err := viper.WriteConfig()
|
|
err := viper.WriteConfig()
|
|
@@ -226,6 +232,12 @@ func (c *CLIConfig) SetProject(projectID uint) error {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *CLIConfig) SetCluster(clusterID uint) error {
|
|
func (c *CLIConfig) SetCluster(clusterID uint) error {
|
|
|
|
|
+ if config.Kubeconfig != "" || viper.IsSet("kubeconfig") {
|
|
|
|
|
+ viper.Set("kubeconfig", "")
|
|
|
|
|
+ color.New(color.FgBlue).Println("Removing local kubeconfig")
|
|
|
|
|
+ config.Kubeconfig = ""
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
viper.Set("cluster", clusterID)
|
|
viper.Set("cluster", clusterID)
|
|
|
color.New(color.FgGreen).Printf("Set the current cluster as %d\n", clusterID)
|
|
color.New(color.FgGreen).Printf("Set the current cluster as %d\n", clusterID)
|
|
|
err := viper.WriteConfig()
|
|
err := viper.WriteConfig()
|