diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-22 14:49:47 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-22 14:49:47 +0000 |
commit | 93b0dbe22c7014e8b05b57e8490a27cd73bf799d (patch) | |
tree | 098f7b744932c43f023be5564a0e1e9d7a58d9ae /becommands | |
parent | b3e66308ac5b8398d5c03bf4ce4d444797bd4486 (diff) | |
download | bugseverywhere-93b0dbe22c7014e8b05b57e8490a27cd73bf799d.tar.gz |
Added options to list command
Diffstat (limited to 'becommands')
-rw-r--r-- | becommands/list.py | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/becommands/list.py b/becommands/list.py index f647564..7e91bb3 100644 --- a/becommands/list.py +++ b/becommands/list.py @@ -1,22 +1,36 @@ """List bugs""" from libbe import bugdir, cmdutil, names +from libbe.mapfile import FileString import os def execute(args): + options, args = get_parser().parse_args(args) + if len(args) > 0: + raise cmdutil.UsageError active = True severity = ("minor", "serious", "critical", "fatal") + if options.wishlist: + severity = ("wishlist",) + if options.closed: + active = False tree = cmdutil.bug_tree() + current_id = names.creator() def filter(bug): + if options.mine and bug.assigned != current_id: + return False + if options.cur_target: + if tree.target is None or bug.target != tree.target: + return False 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.list()) bugs = [b for b in all_bugs if filter(b) ] if len(bugs) == 0: print "No matching bugs found" - current_id = names.creator() my_target_bugs = [] other_target_bugs = [] @@ -63,3 +77,27 @@ def execute(args): list_bugs(my_bugs, "Bugs assigned to you") list_bugs(unassigned_bugs, "Unassigned bugs") list_bugs(other_bugs, "Bugs assigned to others") + + +def get_parser(): + parser = cmdutil.CmdOptionParser("be list [options]") + parser.add_option("-w", "--wishlist", action="store_true", dest="wishlist", + help="List bugs with 'wishlist' severity") + parser.add_option("-c", "--closed", action="store_true", dest="closed", + help="List closed bugs") + parser.add_option("-m", "--mine", action="store_true", dest="mine", + help="List only bugs assigned to you") + parser.add_option("-t", "--cur-target", action="store_true", + dest="cur_target", + help="List only bugs for the current target") + return parser + +longhelp=""" +This command lists bugs. Options are cumulative, so that -mc will list only +closed bugs assigned to you. +""" + +def help(): + fs = FileString() + get_parser().print_help(fs) + return fs.str + longhelp |