aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/remove.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/remove.py')
-rw-r--r--becommands/remove.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/becommands/remove.py b/becommands/remove.py
index 8f7c2c6..fa264b8 100644
--- a/becommands/remove.py
+++ b/becommands/remove.py
@@ -18,7 +18,7 @@
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args):
+def execute(args, test=False):
"""
>>> from libbe import mapfile
>>> import os
@@ -26,7 +26,7 @@ def execute(args):
>>> os.chdir(bd.root)
>>> print bd.bug_from_shortname("b").status
closed
- >>> execute (["b"])
+ >>> execute (["b"], test=True)
Removed bug b
>>> bd._clear_bugs()
>>> try:
@@ -35,10 +35,13 @@ def execute(args):
... print "Bug not found"
Bug not found
"""
- options, args = get_parser().parse_args(args)
+ parser = get_parser()
+ options, args = parser.parse_args(args)
+ cmdutil.default_complete(options, args, parser,
+ bugid_args={0: lambda bug : bug.active==True})
if len(args) != 1:
- raise cmdutil.UserError("Please specify a bug id.")
- bd = bugdir.BugDir(from_disk=True)
+ raise cmdutil.UsageError, "Please specify a bug id."
+ bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
bug = bd.bug_from_shortname(args[0])
bd.remove_bug(bug)
bd.save()