Ensure usage of --delete-all without -p flag
Added skeleton for deleteAllProfiles functionpull/4780/head
parent
13f40f4bf2
commit
dd9afd1783
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/docker/machine/libmachine"
|
"github.com/docker/machine/libmachine"
|
||||||
|
@ -51,6 +52,19 @@ func runDelete(cmd *cobra.Command, args []string) {
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
exit.Usage("usage: minikube delete")
|
exit.Usage("usage: minikube delete")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profileFlag, _ := cmd.Flags().GetString("profile")
|
||||||
|
deleteAllFlag, _ := cmd.Flags().GetBool("delete-all")
|
||||||
|
|
||||||
|
if profileFlag != constants.DefaultMachineName && deleteAllFlag {
|
||||||
|
exit.Usage("usage: minikube delete --delete-all")
|
||||||
|
}
|
||||||
|
|
||||||
|
if deleteAllFlag {
|
||||||
|
profiles := cmdcfg.GetAllProfiles()
|
||||||
|
deleteAllProfiles(profiles)
|
||||||
|
}
|
||||||
|
|
||||||
profileName := viper.GetString(pkg_config.MachineProfile)
|
profileName := viper.GetString(pkg_config.MachineProfile)
|
||||||
api, err := machine.NewAPIClient()
|
api, err := machine.NewAPIClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -96,6 +110,13 @@ func runDelete(cmd *cobra.Command, args []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deleteAllProfiles(profiles []string) {
|
||||||
|
for _, profile := range profiles {
|
||||||
|
fmt.Println(profile)
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
func uninstallKubernetes(api libmachine.API, kc pkg_config.KubernetesConfig, bsName string) {
|
func uninstallKubernetes(api libmachine.API, kc pkg_config.KubernetesConfig, bsName string) {
|
||||||
console.OutStyle(console.Resetting, "Uninstalling Kubernetes %s using %s ...", kc.KubernetesVersion, bsName)
|
console.OutStyle(console.Resetting, "Uninstalling Kubernetes %s using %s ...", kc.KubernetesVersion, bsName)
|
||||||
clusterBootstrapper, err := GetClusterBootstrapper(api, bsName)
|
clusterBootstrapper, err := GetClusterBootstrapper(api, bsName)
|
||||||
|
|
Loading…
Reference in New Issue