(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)
| 44 | } |
| 45 | |
| 46 | func pullCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { |
| 47 | opts := pullOptions{ |
| 48 | ProjectOptions: p, |
| 49 | } |
| 50 | cmd := &cobra.Command{ |
| 51 | Use: "pull [OPTIONS] [SERVICE...]", |
| 52 | Short: "Pull service images", |
| 53 | PreRunE: func(cmd *cobra.Command, args []string) error { |
| 54 | if cmd.Flags().Changed("no-parallel") { |
| 55 | fmt.Fprint(os.Stderr, aec.Apply("option '--no-parallel' is DEPRECATED and will be ignored.\n", aec.RedF)) |
| 56 | } |
| 57 | if cmd.Flags().Changed("parallel") { |
| 58 | fmt.Fprint(os.Stderr, aec.Apply("option '--parallel' is DEPRECATED and will be ignored.\n", aec.RedF)) |
| 59 | } |
| 60 | return nil |
| 61 | }, |
| 62 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 63 | return runPull(ctx, dockerCli, backendOptions, opts, args) |
| 64 | }), |
| 65 | ValidArgsFunction: completeServiceNames(dockerCli, p), |
| 66 | } |
| 67 | flags := cmd.Flags() |
| 68 | flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Pull without printing progress information") |
| 69 | cmd.Flags().BoolVar(&opts.includeDeps, "include-deps", false, "Also pull services declared as dependencies") |
| 70 | cmd.Flags().BoolVar(&opts.parallel, "parallel", true, "DEPRECATED pull multiple images in parallel") |
| 71 | flags.MarkHidden("parallel") //nolint:errcheck |
| 72 | cmd.Flags().BoolVar(&opts.noParallel, "no-parallel", true, "DEPRECATED disable parallel pulling") |
| 73 | flags.MarkHidden("no-parallel") //nolint:errcheck |
| 74 | cmd.Flags().BoolVar(&opts.ignorePullFailures, "ignore-pull-failures", false, "Pull what it can and ignores images with pull failures") |
| 75 | cmd.Flags().BoolVar(&opts.noBuildable, "ignore-buildable", false, "Ignore images that can be built") |
| 76 | cmd.Flags().StringVar(&opts.policy, "policy", "", `Apply pull policy ("missing"|"always")`) |
| 77 | return cmd |
| 78 | } |
| 79 | |
| 80 | func (opts pullOptions) apply(project *types.Project, services []string) (*types.Project, error) { |
| 81 | if !opts.includeDeps { |
no test coverage detected