aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-06-21 09:41:13 -0400
committerW. Trevor King <wking@drexel.edu>2009-06-21 09:41:13 -0400
commit331be32ec51360389fe729e5a946020429e1cf95 (patch)
tree884a61ca23919d92ad9026c25c1bc1d4415e7cea /becommands
parente362eb8e722ea6c63b2addc0d4550b4a7daa55db (diff)
downloadbugseverywhere-331be32ec51360389fe729e5a946020429e1cf95.tar.gz
Added --xml option to becommands/list.py
Diffstat (limited to 'becommands')
-rw-r--r--becommands/list.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/becommands/list.py b/becommands/list.py
index 8c69eaa..9f4e037 100644
--- a/becommands/list.py
+++ b/becommands/list.py
@@ -114,18 +114,24 @@ def execute(args, test=False):
if len(bugs) == 0:
print "No matching bugs found"
- def list_bugs(cur_bugs, title=None, just_uuids=False):
+ def list_bugs(cur_bugs, title=None, just_uuids=False, xml=False):
cur_bugs.sort(bug.cmp_full)
+ if xml == True:
+ print "<bugs>"
if len(cur_bugs) > 0:
- if title != None:
+ if title != None and xml == False:
print cmdutil.underlined(title)
for bg in cur_bugs:
- if just_uuids:
+ if xml == True:
+ print bg.xml(show_comments=True)
+ elif just_uuids:
print bg.uuid
else:
print bg.string(shortlist=True)
+ if xml == True:
+ print "</bugs>"
- list_bugs(bugs, just_uuids=options.uuids)
+ list_bugs(bugs, just_uuids=options.uuids, xml=options.xml)
def get_parser():
parser = cmdutil.CmdOptionParser("be list [options]")
@@ -137,7 +143,7 @@ def get_parser():
help="List options matching ASSIGNED", default=None)
parser.add_option("-t", "--target", metavar="TARGET", dest="target",
help="List options matching TARGET", default=None)
- # boolean options. All but uuids are special cases of long forms
+ # boolean options. All but uuids and xml are special cases of long forms
bools = (("u", "uuids", "Only print the bug UUIDS"),
("w", "wishlist", "List bugs with 'wishlist' severity"),
("i", "important", "List bugs with >= 'serious' severity"),
@@ -146,7 +152,8 @@ def get_parser():
("o", "open", "List open bugs"),
("T", "test", "List bugs in testing"),
("m", "mine", "List bugs assigned to you"),
- ("c", "cur-target", "List bugs for the current target"))
+ ("c", "cur-target", "List bugs for the current target"),
+ ("x", "xml", "Dump as XML"))
for s in bools:
attr = s[1].replace('-','_')
short = "-%c" % s[0]