spud/cli/stop_service.go
Marc Cataford 17221855cc
Some checks failed
/ build (push) Has been cancelled
feat: add explicit flag / arg definitions
2024-09-28 21:49:46 -04:00

30 lines
560 B
Go

// 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]
service.StopService(serviceName)
return nil
},
}
return stop
}