diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-11 18:39:26 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-11 18:39:26 +0000 |
commit | 20a48a1ad3f720d915084d6d139b3790cd4630eb (patch) | |
tree | 4b89c9694971033355bb018af36ddbb578024f65 /be | |
parent | 51c729fdfd03369e2ad7dc6752034469cfbdf253 (diff) | |
download | bugseverywhere-20a48a1ad3f720d915084d6d139b3790cd4630eb.tar.gz |
Modularized commands into files
Diffstat (limited to 'be')
-rwxr-xr-x | be | 74 |
1 files changed, 17 insertions, 57 deletions
@@ -4,11 +4,16 @@ from libbe.bugdir import tree_root, create_bug_dir from libbe import names import sys import os -import commands -import commands.severity +import becommands.severity +import becommands.list +import becommands.show +import becommands.set_root +import becommands.new +import becommands.close +import becommands.open __doc__ = """Bugs Everywhere - Distributed bug tracking -Supported commands +Supported becommands set-root: assign the root directory for bug tracking new: Create a new bug list: list bugs @@ -17,56 +22,11 @@ Supported commands open: re-open a bug severity: %s -Unimplemented commands +Unimplemented becommands comment: append a comment to a bug -""" % commands.severity.__desc__ +""" % becommands.severity.__desc__ -def list_bugs(args): - active = True - severity = ("minor", "serious", "critical", "fatal") - def filter(bug): - if active is not None: - if bug.active != active: - return False - if bug.severity not in severity: - return False - return True - all_bugs = list(tree_root(os.getcwd()).list()) - bugs = [b for b in all_bugs if filter(b) ] - if len(bugs) == 0: - print "No matching bugs found" - for bug in bugs: - print bug_summary(bug, all_bugs) -def show_bug(args): - bug_dir = tree_root(os.getcwd()) - if len(args) !=1: - raise UserError("Please specify a bug id.") - print bug_summary(get_bug(args[0], bug_dir), list(bug_dir.list())) - -def set_root(args): - if len(args) != 1: - raise UserError("Please supply a directory path") - create_bug_dir(args[0]) - -def new_bug(args): - if len(args) != 1: - raise UserError("Please supply a summary message") - dir = tree_root(".") - bugs = (dir.list()) - bug = dir.new_bug() - bug.creator = names.creator() - bug.severity = "minor" - bug.status = "open" - bug.summary = args[0] - -def close_bug(args): - assert(len(args) == 1) - get_bug(args[0], tree_root('.')).status = "closed" - -def open_bug(args): - assert(len(args) == 1) - get_bug(args[0], tree_root('.')).status = "open" if len(sys.argv) == 1: print __doc__ @@ -74,13 +34,13 @@ else: try: try: cmd = { - "list": list_bugs, - "show": show_bug, - "set-root": set_root, - "new": new_bug, - "close": close_bug, - "open": open_bug, - "severity": commands.severity.execute, + "list": becommands.list.execute, + "show": becommands.show.execute, + "set-root": becommands.set_root.execute, + "new": becommands.new.execute, + "close": becommands.close.execute, + "open": becommands.open.execute, + "severity": becommands.severity.execute, }[sys.argv[1]] except KeyError, e: raise UserError("Unknown command \"%s\"" % e.args[0]) |