aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Guirgies <lt.infiltrator@gmail.com>2011-05-25 02:15:11 +1000
committerW. Trevor King <wking@drexel.edu>2011-05-25 06:24:27 -0400
commit287f32bc7f034045454bff1b246aba769eda9e9a (patch)
tree01365e61a9675794e2cc3307dcaae61dfb406e33
parentc5d08a943af56afb4ce1f9ae114bfb756acd0e95 (diff)
downloadbugseverywhere-287f32bc7f034045454bff1b246aba769eda9e9a.tar.gz
Restructure severity help function to match status
The code structure was vastly different in severity.py to status.py, so I mostly copied the structure from there and adjusted it to suit severity. The structure in status.py looked (to me) cleaner, more organised, and easier to work with. Also, users are now referred by "be severity --help" to "be set --help", in a manner similar to "be status --help". For those that don't know that severity can be adjusted on a per repository basis, this seems extremely helpful. A similar message appears for status, but not here.
-rw-r--r--libbe/command/severity.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/libbe/command/severity.py b/libbe/command/severity.py
index a84efe8..c510bc4 100644
--- a/libbe/command/severity.py
+++ b/libbe/command/severity.py
@@ -79,21 +79,26 @@ class Severity (libbe.command.Command):
return 0
def _long_help(self):
- ret = ["""
-Show or change a bug's severity level.
-
-If no severity is specified, the current value is printed. If a severity level
-is specified, it will be assigned to the bug.
-
-Severity levels are:
-"""]
try: # See if there are any per-tree severity configurations
bd = self._get_bugdir()
except NotImplementedError:
pass # No tree, just show the defaults
longest_severity_len = max([len(s) for s in libbe.bug.severity_values])
+ severity_levels = []
for severity in libbe.bug.severity_values :
description = libbe.bug.severity_description[severity]
- ret.append('%*s : %s\n' \
- % (longest_severity_len, severity, description))
- return ''.join(ret)
+ s = '%*s : %s' % (longest_severity_len, severity, description)
+ severity_levels.append(s)
+ ret = """
+Show or change a bug's severity level.
+
+If no severity is specified, the current value is printed. If a severity level
+is specified, it will be assigned to the bug.
+
+Severity levels are:
+ %s
+
+You can overide the list of allowed severities on a per-repository basis.
+See "be set --help" for more details.
+""" % ('\n '.join(severity_levels))
+ return ret