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

Function newListCommand

cli/command/context/list.go:26–44  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

24}
25
26func newListCommand(dockerCLI command.Cli) *cobra.Command {
27 opts := &listOptions{}
28 cmd := &cobra.Command{
29 Use: "ls [OPTIONS]",
30 Aliases: []string{"list"},
31 Short: "List contexts",
32 Args: cli.NoArgs,
33 RunE: func(cmd *cobra.Command, args []string) error {
34 return runList(dockerCLI, opts)
35 },
36 ValidArgsFunction: cobra.NoFileCompletions,
37 DisableFlagsInUseLine: true,
38 }
39
40 flags := cmd.Flags()
41 flags.StringVar(&opts.format, "format", "", flagsHelper.FormatHelp)
42 flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Only show context names")
43 return cmd
44}
45
46func runList(dockerCli command.Cli, opts *listOptions) error {
47 if opts.format == "" {

Callers 1

newContextCommandFunction · 0.70

Calls 1

runListFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…