From fa195bc829f7d7ea1263b7656e2d0b2a54db44b1 Mon Sep 17 00:00:00 2001 From: KingsleyKelly Date: Sun, 22 Feb 2015 23:13:15 +0000 Subject: [PATCH] Add -f flag as option on rm. Signed-off-by: Kingsley Kelly --- compose/cli/main.py | 4 ++-- tests/integration/cli_test.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compose/cli/main.py b/compose/cli/main.py index cfe29cd077d..858f1947912 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -238,8 +238,8 @@ def rm(self, project, options): Usage: rm [options] [SERVICE...] Options: - --force Don't ask to confirm removal - -v Remove volumes associated with containers + -f, --force Don't ask to confirm removal + -v Remove volumes associated with containers """ all_containers = project.containers(service_names=options['SERVICE'], stopped=True) stopped_containers = [c for c in all_containers if not c.is_running] diff --git a/tests/integration/cli_test.py b/tests/integration/cli_test.py index cf939837929..32c4294cc20 100644 --- a/tests/integration/cli_test.py +++ b/tests/integration/cli_test.py @@ -295,6 +295,12 @@ def test_rm(self): self.assertEqual(len(service.containers(stopped=True)), 1) self.command.dispatch(['rm', '--force'], None) self.assertEqual(len(service.containers(stopped=True)), 0) + service = self.project.get_service('simple') + service.create_container() + service.kill() + self.assertEqual(len(service.containers(stopped=True)), 1) + self.command.dispatch(['rm', '-f'], None) + self.assertEqual(len(service.containers(stopped=True)), 0) def test_kill(self): self.command.dispatch(['up', '-d'], None)