(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)
| 33 | } |
| 34 | |
| 35 | func restartCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { |
| 36 | opts := restartOptions{ |
| 37 | ProjectOptions: p, |
| 38 | } |
| 39 | restartCmd := &cobra.Command{ |
| 40 | Use: "restart [OPTIONS] [SERVICE...]", |
| 41 | Short: "Restart service containers", |
| 42 | PreRun: func(cmd *cobra.Command, args []string) { |
| 43 | opts.timeChanged = cmd.Flags().Changed("timeout") |
| 44 | }, |
| 45 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 46 | return runRestart(ctx, dockerCli, backendOptions, opts, args) |
| 47 | }), |
| 48 | ValidArgsFunction: completeServiceNames(dockerCli, p), |
| 49 | } |
| 50 | flags := restartCmd.Flags() |
| 51 | flags.IntVarP(&opts.timeout, "timeout", "t", 0, "Specify a shutdown timeout in seconds") |
| 52 | flags.BoolVar(&opts.noDeps, "no-deps", false, "Don't restart dependent services") |
| 53 | |
| 54 | return restartCmd |
| 55 | } |
| 56 | |
| 57 | func runRestart(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts restartOptions, services []string) error { |
| 58 | project, name, err := opts.projectOrName(ctx, dockerCli) |
no test coverage detected