aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-06-25 08:30:52 -0400
committerW. Trevor King <wking@drexel.edu>2009-06-25 08:30:52 -0400
commitd61b9a76a1ffc9daec72456aa4549bf3e3093f29 (patch)
tree6116b13cafd7e0a3a99bcfa1eb3556af1b9e206a /becommands
parente95942bdf1f5ad6703c20e87b3368302801370ae (diff)
downloadbugseverywhere-d61b9a76a1ffc9daec72456aa4549bf3e3093f29.tar.gz
Added `be tag --list' to list all tags.
Loading all the bugs for the list search had the side effect of updating all the bug values files to the new YAML format.
Diffstat (limited to 'becommands')
-rw-r--r--becommands/tag.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/becommands/tag.py b/becommands/tag.py
index b8030f3..8697464 100644
--- a/becommands/tag.py
+++ b/becommands/tag.py
@@ -1,5 +1,4 @@
-# Copyright (C) 2005 Aaron Bentley and Panometrics, Inc.
-# <abentley@panoramicfeedback.com>
+# Copyright (C) 2009 W. Trevor King <wking@drexel.edu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,6 +41,9 @@ def execute(args, test=False):
Tags for a:
GUI
later
+ >>> execute(["--list"], test=True)
+ GUI
+ later
>>> execute(["a", "Alphabetically first"], test=True)
Tagging bug a:
Alphabetically first
@@ -72,13 +74,25 @@ def execute(args, test=False):
cmdutil.default_complete(options, args, parser,
bugid_args={0: lambda bug : bug.active==True})
- if len(args) < 1:
+ if len(args) == 0 and options.list == False:
raise cmdutil.UsageError("Please specify a bug id.")
- if len(args) > 2:
+ elif len(args) > 2 or (len(args) > 0 and options.list == True):
help()
raise cmdutil.UsageError("Too many arguments.")
bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+ if options.list:
+ bd.load_all_bugs()
+ tags = []
+ for bug in bd:
+ for estr in bug.extra_strings:
+ if estr.startswith("TAG:"):
+ tag = estr[4:]
+ if tag not in tags:
+ tags.append(tag)
+ tags.sort()
+ print '\n'.join(tags)
+ return
bug = bd.bug_from_shortname(args[0])
new_tag = None
@@ -108,9 +122,11 @@ def execute(args, test=False):
print tag
def get_parser():
- parser = cmdutil.CmdOptionParser("be tag BUG-ID [TAG]")
+ parser = cmdutil.CmdOptionParser("be tag BUG-ID [TAG]\nor: be tag --list")
parser.add_option("-r", "--remove", action="store_true", dest="remove",
help="Remove TAG (instead of adding it)")
+ parser.add_option("-l", "--list", action="store_true", dest="list",
+ help="List all available tags and exit")
return parser
longhelp="""