2024-09-27 00:38:01 +00:00
|
|
|
// Stopping services
|
|
|
|
//
|
|
|
|
// Commands related to stopping services.
|
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
2024-09-29 01:47:48 +00:00
|
|
|
"fmt"
|
2024-09-27 00:38:01 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
service "spud/service"
|
|
|
|
)
|
|
|
|
|
2024-09-29 01:47:48 +00:00
|
|
|
func getStopCommand() *cobra.Command {
|
|
|
|
stop := &cobra.Command{
|
|
|
|
Use: "stop [service-name]",
|
|
|
|
Short: "Stops a running service and all of its containers.",
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
if len(args) == 0 {
|
|
|
|
return fmt.Errorf("Must specify a service using '--service'")
|
|
|
|
}
|
|
|
|
|
|
|
|
serviceName := args[0]
|
|
|
|
|
2024-10-05 00:05:33 +00:00
|
|
|
return service.NewPodmanServiceManager().Stop(serviceName)
|
2024-09-29 01:47:48 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return stop
|
2024-09-27 00:38:01 +00:00
|
|
|
}
|