Merge pull request #1007 from KingsleyKelly/force

Add -f flag as option on rm.
This commit is contained in:
Aanand Prasad 2015-03-02 11:26:28 +00:00
commit f89f9e3190
2 changed files with 8 additions and 2 deletions

View File

@ -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]

View File

@ -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)