@@ -9,16 +9,18 @@ import (
99 "github.com/docker/cli/cli/command"
1010 "github.com/docker/cli/cli/command/completion"
1111 "github.com/docker/cli/cli/command/stack/formatter"
12- "github.com/docker/cli/cli/command/stack/options"
1312 "github.com/docker/cli/cli/command/stack/swarm"
1413 flagsHelper "github.com/docker/cli/cli/flags"
1514 "github.com/fvbommel/sortorder"
1615 "github.com/spf13/cobra"
1716)
1817
19- type listOptions = options.List
18+ // listOptions holds docker stack ls options
19+ type listOptions struct {
20+ format string
21+ }
2022
21- func newListCommand (dockerCli command.Cli ) * cobra.Command {
23+ func newListCommand (dockerCLI command.Cli ) * cobra.Command {
2224 opts := listOptions {}
2325
2426 cmd := & cobra.Command {
@@ -27,23 +29,16 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
2729 Short : "List stacks" ,
2830 Args : cli .NoArgs ,
2931 RunE : func (cmd * cobra.Command , args []string ) error {
30- return runList (cmd .Context (), dockerCli , opts )
32+ return runList (cmd .Context (), dockerCLI , opts )
3133 },
3234 ValidArgsFunction : completion .NoComplete ,
3335 }
3436
3537 flags := cmd .Flags ()
36- flags .StringVar (& opts .Format , "format" , "" , flagsHelper .FormatHelp )
38+ flags .StringVar (& opts .format , "format" , "" , flagsHelper .FormatHelp )
3739 return cmd
3840}
3941
40- // RunList performs a stack list against the specified swarm cluster
41- //
42- // Deprecated: this function was for internal use and will be removed in the next release.
43- func RunList (ctx context.Context , dockerCLI command.Cli , opts options.List ) error {
44- return runList (ctx , dockerCLI , opts )
45- }
46-
4742// runList performs a stack list against the specified swarm cluster
4843func runList (ctx context.Context , dockerCLI command.Cli , opts listOptions ) error {
4944 stacks , err := swarm .GetStacks (ctx , dockerCLI .Client ())
@@ -54,7 +49,7 @@ func runList(ctx context.Context, dockerCLI command.Cli, opts listOptions) error
5449}
5550
5651func format (out io.Writer , opts listOptions , stacks []formatter.Stack ) error {
57- fmt := formatter .Format (opts .Format )
52+ fmt := formatter .Format (opts .format )
5853 if fmt == "" || fmt == formatter .TableFormatKey {
5954 fmt = formatter .SwarmStackTableFormat
6055 }
0 commit comments