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

Function runList

cli/command/network/list.go:48–74  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, options listOptions)

Source from the content-addressed store, hash-verified

46}
47
48func runList(ctx context.Context, dockerCLI command.Cli, options listOptions) error {
49 apiClient := dockerCLI.Client()
50 res, err := apiClient.NetworkList(ctx, client.NetworkListOptions{Filters: options.filter.Value()})
51 if err != nil {
52 return err
53 }
54
55 format := options.format
56 if len(format) == 0 {
57 if len(dockerCLI.ConfigFile().NetworksFormat) > 0 && !options.quiet {
58 format = dockerCLI.ConfigFile().NetworksFormat
59 } else {
60 format = formatter.TableFormatKey
61 }
62 }
63
64 sort.Slice(res.Items, func(i, j int) bool {
65 return sortorder.NaturalLess(res.Items[i].Name, res.Items[j].Name)
66 })
67
68 networksCtx := formatter.Context{
69 Output: dockerCLI.Out(),
70 Format: newFormat(format, options.quiet),
71 Trunc: !options.noTrunc,
72 }
73 return formatWrite(networksCtx, res)
74}

Callers 1

newListCommandFunction · 0.70

Calls 7

newFormatFunction · 0.70
formatWriteFunction · 0.70
ClientMethod · 0.65
ValueMethod · 0.65
ConfigFileMethod · 0.65
OutMethod · 0.65
NetworkListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…