Browse Source

Merge pull request #1007 from KingsleyKelly/force

Add -f flag as option on rm.
Aanand Prasad 10 years ago
parent
commit
f89f9e3190
2 changed files with 8 additions and 2 deletions
  1. 2 2
      compose/cli/main.py
  2. 6 0
      tests/integration/cli_test.py

+ 2 - 2
compose/cli/main.py

@@ -238,8 +238,8 @@ class TopLevelCommand(Command):
         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]

+ 6 - 0
tests/integration/cli_test.py

@@ -295,6 +295,12 @@ class CLITestCase(DockerClientTestCase):
         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)