30 lines
560 B
Go
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
|
|
}
|