From 8d476eee4c96d285d06f7c3c4978cacf2c8b9ca4 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 6 Aug 2021 15:29:45 +0200 Subject: [PATCH] apply filter before formatter Signed-off-by: Nicolas De Loof --- cmd/compose/ps.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/compose/ps.go b/cmd/compose/ps.go index 9bb9a6e5a..0adc24d86 100644 --- a/cmd/compose/ps.go +++ b/cmd/compose/ps.go @@ -127,13 +127,6 @@ SERVICES: return api.ErrNotFound } - if opts.Quiet { - for _, s := range containers { - fmt.Println(s.ID) - } - return nil - } - if opts.Status != "" { containers = filterByStatus(containers, opts.Status) } @@ -142,6 +135,13 @@ SERVICES: return containers[i].Name < containers[j].Name }) + if opts.Quiet { + for _, c := range containers { + fmt.Println(c.ID) + } + return nil + } + return formatter.Print(containers, opts.Format, os.Stdout, writter(containers), "NAME", "COMMAND", "SERVICE", "STATUS", "PORTS")