spud/cli/stop_service.go

29 lines
571 B
Go
Raw Normal View History

// Stopping services
//
// Commands related to stopping services.
package cli
import (
"fmt"
"github.com/spf13/cobra"
service "spud/service"
)
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]
return service.NewPodmanServiceManager().Stop(serviceName)
},
}
return stop
}