Accept -f argument to remove
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 29 Oct 2013 05:36:56 +0000 (13:36 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 29 Oct 2013 05:36:56 +0000 (13:36 +0800)
lib/commands/remove.py

index e288713..4b5687f 100644 (file)
@@ -42,6 +42,14 @@ class RemoveCommand(Command):
                 'dest': 'do',
                 'help': 'do not ask for confirmation'
             }
+        ),
+        (
+            ['-f'],
+            {
+                'action': 'store_true',
+                'dest': 'force',
+                'help': 'force and do not ask for confirmation'
+            }
         )
     ]
     _description = 'Completely remove an instance'
@@ -53,7 +61,7 @@ class RemoveCommand(Command):
         except:
             raise Exception('This is not a Moodle instance')
 
-        if not args.do:
+        if not args.do and not args.force:
             confirm = raw_input('Are you sure? (Y/n) ')
             if confirm != 'Y':
                 logging.info('Aborting...')