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

Function runPs

cli/command/container/list.go:117–141  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, options *psOptions)

Source from the content-addressed store, hash-verified

115}
116
117func runPs(ctx context.Context, dockerCLI command.Cli, options *psOptions) error {
118 if len(options.format) == 0 {
119 // load custom psFormat from CLI config (if any)
120 options.format = dockerCLI.ConfigFile().PsFormat
121 } else if options.quiet {
122 _, _ = dockerCLI.Err().Write([]byte("WARNING: Ignoring custom format, because both --format and --quiet are set.\n"))
123 }
124
125 listOptions, err := buildContainerListOptions(options)
126 if err != nil {
127 return err
128 }
129
130 res, err := dockerCLI.Client().ContainerList(ctx, listOptions)
131 if err != nil {
132 return err
133 }
134
135 containerCtx := formatter.Context{
136 Output: dockerCLI.Out(),
137 Format: formatter.NewContainerFormat(options.format, options.quiet, listOptions.Size),
138 Trunc: !options.noTrunc,
139 }
140 return formatter.ContainerWrite(containerCtx, res.Items)
141}

Callers 1

newPsCommandFunction · 0.70

Calls 7

ConfigFileMethod · 0.65
ErrMethod · 0.65
ClientMethod · 0.65
OutMethod · 0.65
WriteMethod · 0.45
ContainerListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…