(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)
| 38 | } |
| 39 | |
| 40 | func scaleCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { |
| 41 | opts := scaleOptions{ |
| 42 | ProjectOptions: p, |
| 43 | } |
| 44 | scaleCmd := &cobra.Command{ |
| 45 | Use: "scale [SERVICE=REPLICAS...]", |
| 46 | Short: "Scale services ", |
| 47 | Args: cobra.MinimumNArgs(1), |
| 48 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 49 | serviceTuples, err := parseServicesReplicasArgs(args) |
| 50 | if err != nil { |
| 51 | return err |
| 52 | } |
| 53 | return runScale(ctx, dockerCli, backendOptions, opts, serviceTuples) |
| 54 | }), |
| 55 | ValidArgsFunction: completeScaleArgs(dockerCli, p), |
| 56 | } |
| 57 | flags := scaleCmd.Flags() |
| 58 | flags.BoolVar(&opts.noDeps, "no-deps", false, "Don't start linked services") |
| 59 | |
| 60 | return scaleCmd |
| 61 | } |
| 62 | |
| 63 | func runScale(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts scaleOptions, serviceReplicaTuples map[string]int) error { |
| 64 | backend, err := compose.NewComposeService(dockerCli, backendOptions.Options...) |
no test coverage detected