From 192fce9153d3a089288ce036215cdeb32a7d2134 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Sun, 14 Sep 2014 16:04:40 -0400 Subject: [PATCH] Resolves #43 - sort containers in ps output by name, so services are grouped together. Signed-off-by: Daniel Nephin --- fig/cli/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fig/cli/main.py b/fig/cli/main.py index 3ecc87b23..36ae62524 100644 --- a/fig/cli/main.py +++ b/fig/cli/main.py @@ -4,6 +4,7 @@ import logging import sys import re import signal +from operator import attrgetter from inspect import getdoc import dockerpty @@ -180,7 +181,10 @@ class TopLevelCommand(Command): Options: -q Only display IDs """ - containers = project.containers(service_names=options['SERVICE'], stopped=True) + project.containers(service_names=options['SERVICE'], one_off=True) + containers = sorted( + project.containers(service_names=options['SERVICE'], stopped=True) + + project.containers(service_names=options['SERVICE'], one_off=True), + key=attrgetter('name')) if options['-q']: for container in containers: