MCPcopy Index your code
hub / github.com/docker/cli / newListCommand

Function newListCommand

cli/command/plugin/list.go:24–47  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

22}
23
24func 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
49func runList(ctx context.Context, dockerCli command.Cli, options listOptions) error {
50 resp, err := dockerCli.Client().PluginList(ctx, client.PluginListOptions{

Callers 3

newPluginCommandFunction · 0.70
TestListErrorsFunction · 0.70
TestListFunction · 0.70

Calls 1

runListFunction · 0.70

Tested by 2

TestListErrorsFunction · 0.56
TestListFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…