(dockerCLI command.Cli)
| 22 | } |
| 23 | |
| 24 | func newListCommand(dockerCLI command.Cli) *cobra.Command { |
| 25 | options := listOptions{filter: opts.NewFilterOpt()} |
| 26 | |
| 27 | cmd := &cobra.Command{ |
| 28 | Use: "ls [OPTIONS]", |
| 29 | Short: "List plugins", |
| 30 | Aliases: []string{"list"}, |
| 31 | Args: cli.NoArgs, |
| 32 | RunE: func(cmd *cobra.Command, args []string) error { |
| 33 | return runList(cmd.Context(), dockerCLI, options) |
| 34 | }, |
| 35 | ValidArgsFunction: cobra.NoFileCompletions, |
| 36 | DisableFlagsInUseLine: true, |
| 37 | } |
| 38 | |
| 39 | flags := cmd.Flags() |
| 40 | |
| 41 | flags.BoolVarP(&options.quiet, "quiet", "q", false, "Only display plugin IDs") |
| 42 | flags.BoolVar(&options.noTrunc, "no-trunc", false, "Don't truncate output") |
| 43 | flags.StringVar(&options.format, "format", "", flagsHelper.FormatHelp) |
| 44 | flags.VarP(&options.filter, "filter", "f", `Provide filter values (e.g. "enabled=true")`) |
| 45 | |
| 46 | return cmd |
| 47 | } |
| 48 | |
| 49 | func runList(ctx context.Context, dockerCli command.Cli, options listOptions) error { |
| 50 | resp, err := dockerCli.Client().PluginList(ctx, client.PluginListOptions{ |
searching dependent graphs…