Browse Source

Merge pull request #1995 from ndeloof/ps_filter_q

apply filter before formatter
Nicolas De loof 4 years ago
parent
commit
5cfa7f51b4
1 changed files with 7 additions and 7 deletions
  1. 7 7
      cmd/compose/ps.go

+ 7 - 7
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")