From 2ca0e7954a9208dce1bb501dd15972fbf7a7910d Mon Sep 17 00:00:00 2001 From: Ben Firshman Date: Tue, 4 Mar 2014 10:25:50 +0000 Subject: [PATCH] Add --force option to fig rm --- fig/cli/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fig/cli/main.py b/fig/cli/main.py index 178a61d0e..668ef9e8a 100644 --- a/fig/cli/main.py +++ b/fig/cli/main.py @@ -170,17 +170,19 @@ class TopLevelCommand(Command): """ Remove stopped service containers. - Usage: rm [SERVICE...] + Usage: rm [options] [SERVICE...] Options: - -v Remove volumes associated with containers + --force Don't ask to confirm removal + -v Remove volumes associated with containers """ all_containers = self.project.containers(service_names=options['SERVICE'], stopped=True) stopped_containers = [c for c in all_containers if not c.is_running] if len(stopped_containers) > 0: print("Going to remove", list_containers(stopped_containers)) - if yesno("Are you sure? [yN] ", default=False): + if options.get('--force') \ + or yesno("Are you sure? [yN] ", default=False): self.project.remove_stopped(service_names=options['SERVICE'], remove_volumes=options.get('-v', False)) else: