(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)
| 43 | } |
| 44 | |
| 45 | func imagesCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { |
| 46 | opts := imageOptions{ |
| 47 | ProjectOptions: p, |
| 48 | } |
| 49 | imgCmd := &cobra.Command{ |
| 50 | Use: "images [OPTIONS] [SERVICE...]", |
| 51 | Short: "List images used by the created containers", |
| 52 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 53 | return runImages(ctx, dockerCli, backendOptions, opts, args) |
| 54 | }), |
| 55 | ValidArgsFunction: completeServiceNames(dockerCli, p), |
| 56 | } |
| 57 | imgCmd.Flags().StringVar(&opts.Format, "format", "table", "Format the output. Values: [table | json]") |
| 58 | imgCmd.Flags().BoolVarP(&opts.Quiet, "quiet", "q", false, "Only display IDs") |
| 59 | return imgCmd |
| 60 | } |
| 61 | |
| 62 | func runImages(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts imageOptions, services []string) error { |
| 63 | projectName, err := opts.toProjectName(ctx, dockerCli) |
no test coverage detected