forked from abiosoft/colima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.go
41 lines (33 loc) · 1.01 KB
/
delete.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package cmd
import (
"github.com/abiosoft/colima/cli"
"github.com/abiosoft/colima/cmd/root"
"github.com/abiosoft/colima/config"
"github.com/spf13/cobra"
)
var deleteCmdArgs struct {
force bool
}
// deleteCmd represents the delete command
var deleteCmd = &cobra.Command{
Use: "delete [profile]",
Short: "delete and teardown Colima",
Long: `Delete and teardown Colima and all settings.
Use with caution. This deletes everything and a startup afterwards is like the
initial startup of Colima.
If you simply want to reset the Kubernetes cluster, run 'colima kubernetes reset'.`,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if !deleteCmdArgs.force {
y := cli.Prompt("are you sure you want to delete " + config.CurrentProfile().DisplayName + " and all settings")
if !y {
return nil
}
}
return newApp().Delete()
},
}
func init() {
root.Cmd().AddCommand(deleteCmd)
deleteCmd.Flags().BoolVarP(&deleteCmdArgs.force, "force", "f", false, "do not prompt for yes/no")
}