render quiet after filtering applied

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2023-11-10 13:59:01 +01:00 committed by Nicolas De loof
parent 254a94b07d
commit c16943609c

View File

@ -72,12 +72,6 @@ func runList(ctx context.Context, dockerCli command.Cli, backend api.Service, ls
if err != nil {
return err
}
if lsOpts.Quiet {
for _, s := range stackList {
fmt.Fprintln(dockerCli.Out(), s.Name)
}
return nil
}
if filters.Len() > 0 {
var filtered []api.Stack
@ -90,6 +84,13 @@ func runList(ctx context.Context, dockerCli command.Cli, backend api.Service, ls
stackList = filtered
}
if lsOpts.Quiet {
for _, s := range stackList {
fmt.Fprintln(dockerCli.Out(), s.Name)
}
return nil
}
view := viewFromStackList(stackList)
return formatter.Print(view, lsOpts.Format, dockerCli.Out(), func(w io.Writer) {
for _, stack := range view {