diff options
Diffstat (limited to 'becommands/close.py')
-rw-r--r-- | becommands/close.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/becommands/close.py b/becommands/close.py index 8d2ccdb..d8826b0 100644 --- a/becommands/close.py +++ b/becommands/close.py @@ -18,7 +18,7 @@ from libbe import cmdutil, bugdir __desc__ = __doc__ -def execute(args): +def execute(args, test=False): """ >>> from libbe import bugdir >>> import os @@ -26,18 +26,20 @@ def execute(args): >>> os.chdir(bd.root) >>> print bd.bug_from_shortname("a").status open - >>> execute(["a"]) + >>> execute(["a"], test=True) >>> bd._clear_bugs() >>> print bd.bug_from_shortname("a").status closed """ - 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) == 0: - raise cmdutil.UserError("Please specify a bug id.") + raise cmdutil.UsageError("Please specify a bug id.") if len(args) > 1: - help() - raise cmdutil.UserError("Too many arguments.") - bd = bugdir.BugDir(from_disk=True) + raise cmdutil.UsageError("Too many arguments.") + bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) bug = bd.bug_from_shortname(args[0]) bug.status = "closed" bd.save() |