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

Function runList

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

Source from the content-addressed store, hash-verified

42}
43
44func runList(ctx context.Context, dockerCLI command.Cli, options listOptions) error {
45 apiClient := dockerCLI.Client()
46 res, err := apiClient.ServiceList(ctx, client.ServiceListOptions{
47 Filters: options.filter.Value(),
48 // When not running "quiet", also get service status (number of running
49 // and desired tasks). Note that this is only supported on API v1.41 and
50 // up; older API versions ignore this option, and we will have to collect
51 // the information manually below.
52 Status: !options.quiet,
53 })
54 if err != nil {
55 return err
56 }
57
58 format := options.format
59 if len(format) == 0 {
60 if len(dockerCLI.ConfigFile().ServicesFormat) > 0 && !options.quiet {
61 format = dockerCLI.ConfigFile().ServicesFormat
62 } else {
63 format = formatter.TableFormatKey
64 }
65 }
66
67 servicesCtx := formatter.Context{
68 Output: dockerCLI.Out(),
69 Format: NewListFormat(format, options.quiet),
70 }
71 return ListFormatWrite(servicesCtx, res)
72}

Callers 1

newListCommandFunction · 0.70

Calls 7

NewListFormatFunction · 0.85
ListFormatWriteFunction · 0.85
ClientMethod · 0.65
ValueMethod · 0.65
ConfigFileMethod · 0.65
OutMethod · 0.65
ServiceListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…