diff options
-rwxr-xr-x | be | 18 | ||||
-rw-r--r-- | libbe/cmdutil.py | 11 |
2 files changed, 21 insertions, 8 deletions
@@ -5,6 +5,7 @@ Supported commands set-root: assign the root directory for bug tracking new: Create a new bug list: list bugs + show: show a particular bug close: close a bug open: re-open a bug @@ -32,14 +33,14 @@ def list_bugs(args): if len(bugs) == 0: print "No matching bugs found" for bug in bugs: - target = bug.target - if target is None: - target = "" - else: - target = " target: %s" % target - print "id: %s severity: %s%s creator: %s \n%s\n" % \ - (unique_name(bug, bugs), bug.severity, target, bug.creator, - bug.summary) + print bug_summary(bug, 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") @@ -72,6 +73,7 @@ else: try: cmd = { "list": list_bugs, + "show": show_bug, "set-root": set_root, "new": new_bug, "close": close_bug, diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py index 2214260..ffd141e 100644 --- a/libbe/cmdutil.py +++ b/libbe/cmdutil.py @@ -33,3 +33,14 @@ def get_bug(spec, bug_dir): if len(matches) == 0: raise UserError("No bug has the name %s" % spec) return matches[0] + +def bug_summary(bug, bugs): + target = bug.target + if target is None: + target = "" + else: + target = " target: %s" % target + return "id: %s severity: %s%s creator: %s \n%s\n" % \ + (unique_name(bug, bugs), bug.severity, target, bug.creator, + bug.summary) + |