runPS is the swarm implementation of docker stack ps
(ctx context.Context, dockerCLI command.Cli, opts psOptions)
| 52 | |
| 53 | // runPS is the swarm implementation of docker stack ps |
| 54 | func 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 | } |
no test coverage detected
searching dependent graphs…