(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)
| 32 | } |
| 33 | |
| 34 | func stopCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { |
| 35 | opts := stopOptions{ |
| 36 | ProjectOptions: p, |
| 37 | } |
| 38 | cmd := &cobra.Command{ |
| 39 | Use: "stop [OPTIONS] [SERVICE...]", |
| 40 | Short: "Stop services", |
| 41 | PreRun: func(cmd *cobra.Command, args []string) { |
| 42 | opts.timeChanged = cmd.Flags().Changed("timeout") |
| 43 | }, |
| 44 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 45 | return runStop(ctx, dockerCli, backendOptions, opts, args) |
| 46 | }), |
| 47 | ValidArgsFunction: completeServiceNames(dockerCli, p), |
| 48 | } |
| 49 | flags := cmd.Flags() |
| 50 | flags.IntVarP(&opts.timeout, "timeout", "t", 0, "Specify a shutdown timeout in seconds") |
| 51 | |
| 52 | return cmd |
| 53 | } |
| 54 | |
| 55 | func runStop(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts stopOptions, services []string) error { |
| 56 | project, name, err := opts.projectOrName(ctx, dockerCli, services...) |
no test coverage detected