runList performs a stack list against the specified swarm cluster
(ctx context.Context, dockerCLI command.Cli, opts listOptions)
| 39 | |
| 40 | // runList performs a stack list against the specified swarm cluster |
| 41 | func runList(ctx context.Context, dockerCLI command.Cli, opts listOptions) error { |
| 42 | stacks, err := getStacks(ctx, dockerCLI.Client()) |
| 43 | if err != nil { |
| 44 | return err |
| 45 | } |
| 46 | |
| 47 | format := formatter.Format(opts.format) |
| 48 | if format == "" || format == formatter.TableFormatKey { |
| 49 | format = stackTableFormat |
| 50 | } |
| 51 | stackCtx := formatter.Context{ |
| 52 | Output: dockerCLI.Out(), |
| 53 | Format: format, |
| 54 | } |
| 55 | sort.Slice(stacks, func(i, j int) bool { |
| 56 | return sortorder.NaturalLess(stacks[i].Name, stacks[j].Name) |
| 57 | }) |
| 58 | return stackWrite(stackCtx, stacks) |
| 59 | } |
no test coverage detected
searching dependent graphs…