From: Tim Guirgies Date: Tue, 24 May 2011 16:15:11 +0000 (+1000) Subject: Restructure severity help function to match status X-Git-Tag: 1.1.0~185 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=287f32bc7f034045454bff1b246aba769eda9e9a;p=be.git 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. --- 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