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

Function runPS

cli/command/stack/ps.go:54–72  ·  view source on GitHub ↗

runPS is the swarm implementation of docker stack ps

(ctx context.Context, dockerCLI command.Cli, opts psOptions)

Source from the content-addressed store, hash-verified

52
53// runPS is the swarm implementation of docker stack ps
54func runPS(ctx context.Context, dockerCLI command.Cli, opts psOptions) error {
55 apiClient := dockerCLI.Client()
56 res, err := apiClient.TaskList(ctx, client.TaskListOptions{
57 Filters: getStackFilterFromOpt(opts.namespace, opts.filter),
58 })
59 if err != nil {
60 return err
61 }
62
63 if len(res.Items) == 0 {
64 return fmt.Errorf("nothing found in stack: %s", opts.namespace)
65 }
66
67 if opts.format == "" {
68 opts.format = task.DefaultFormat(dockerCLI.ConfigFile(), opts.quiet)
69 }
70
71 return task.Print(ctx, dockerCLI, res, idresolver.New(apiClient, opts.noResolve), !opts.noTrunc, opts.quiet, opts.format)
72}

Callers 1

newPsCommandFunction · 0.70

Calls 5

getStackFilterFromOptFunction · 0.85
ClientMethod · 0.65
ConfigFileMethod · 0.65
TaskListMethod · 0.45
PrintMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…