aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command/list.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-06-25 14:31:34 -0400
committerW. Trevor King <wking@drexel.edu>2010-06-25 14:31:34 -0400
commit57c61e2e78078322bfae6b338bede66ec3107203 (patch)
treeed29d453702a854c1f9c9076ff844ff4b5e198f7 /libbe/command/list.py
parenteaa9ad50c853e57d85b774c69cd338458e648329 (diff)
downloadbugseverywhere-57c61e2e78078322bfae6b338bede66ec3107203.tar.gz
Added --tags to `be list`.
And broke out tagging functions in libbe.command.tag, so they are accessible to other commands.
Diffstat (limited to 'libbe/command/list.py')
-rw-r--r--libbe/command/list.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/libbe/command/list.py b/libbe/command/list.py
index a522b4a..197604b 100644
--- a/libbe/command/list.py
+++ b/libbe/command/list.py
@@ -25,6 +25,7 @@ import libbe
import libbe.bug
import libbe.command
import libbe.command.depend
+import libbe.command.tag
import libbe.command.target
import libbe.command.util
@@ -127,6 +128,8 @@ class List (libbe.command.Command):
arg=libbe.command.Argument(
name='sort', metavar='SORT', default=None,
completion_callback=libbe.command.util.Completer(AVAILABLE_CMPS))),
+ libbe.command.Option(name='tags', short_name='t',
+ help='Add TAGS: field to standard listing format.'),
libbe.command.Option(name='ids', short_name='i',
help='Only print the bug IDS'),
libbe.command.Option(name='xml', short_name='x',
@@ -173,7 +176,7 @@ class List (libbe.command.Command):
for bug in bugs:
print >> self.stdout, bug.id.user()
else:
- self._list_bugs(bugs, xml=params['xml'])
+ self._list_bugs(bugs, show_tags=params['tags'], xml=params['xml'])
bugdir.storage.writeable = writeable
return 0
@@ -230,7 +233,7 @@ class List (libbe.command.Command):
bugs.sort(cmp_fn)
return bugs
- def _list_bugs(self, bugs, xml=False):
+ def _list_bugs(self, bugs, show_tags=False, xml=False):
if xml == True:
print >> self.stdout, \
'<?xml version="1.0" encoding="%s" ?>' % self.stdout.encoding
@@ -240,18 +243,27 @@ class List (libbe.command.Command):
if xml == True:
print >> self.stdout, bug.xml(show_comments=True)
else:
- print >> self.stdout, bug.string(shortlist=True)
+ bug_string = bug.string(shortlist=True)
+ if show_tags == True:
+ attrs,summary = bug_string.split(' ', 1)
+ bug_string = (
+ '%s%s: %s'
+ % (attrs,
+ ','.join(libbe.command.tag.get_tags(bug)),
+ summary))
+ print >> self.stdout, bug_string
if xml == True:
print >> self.stdout, '</be-xml>'
def _long_help(self):
return """
This command lists bugs. Normally it prints a short string like
- bea/576:om: Allow attachments
+ bea/576:om:[TAGS:] Allow attachments
Where
bea/576 the bug id
o the bug status is 'open' (first letter)
m the bug severity is 'minor' (first letter)
+ TAGS comma-separated list of bug tags (if --tags is set)
Allo... the bug summary string
You can optionally (-u) print only the bug ids.