forked from abiosoft/colima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop.go
30 lines (24 loc) · 689 Bytes
/
stop.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
package cmd
import (
"github.com/abiosoft/colima/cmd/root"
"github.com/spf13/cobra"
)
var stopCmdArgs struct {
force bool
}
// stopCmd represents the stop command
var stopCmd = &cobra.Command{
Use: "stop [profile]",
Short: "stop Colima",
Long: `Stop stops Colima to free up resources.
The state of the VM is persisted at stop. A start afterwards
should return it back to its previous state.`,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return newApp().Stop(stopCmdArgs.force)
},
}
func init() {
root.Cmd().AddCommand(stopCmd)
stopCmd.Flags().BoolVarP(&stopCmdArgs.force, "force", "f", false, "stop without graceful shutdown")
}