diff options
| author | Salvatore Orlando <salvatore.orlando@eu.citrix.com> | 2011-03-25 02:04:13 +0000 |
|---|---|---|
| committer | Salvatore Orlando <salvatore.orlando@eu.citrix.com> | 2011-03-25 02:04:13 +0000 |
| commit | ed3135232829794cfbb5a47765f5d078ba9216cf (patch) | |
| tree | 16adde5a715344b6f62b4c80b7816f4a64e0d478 /bin/stack | |
| parent | 6fcaacdbca90b7c15a4f0649765cd3b538463fd7 (diff) | |
| parent | e26e360106c2aeb468be90de609caaf03e1dab43 (diff) | |
| download | nova-ed3135232829794cfbb5a47765f5d078ba9216cf.tar.gz nova-ed3135232829794cfbb5a47765f5d078ba9216cf.tar.xz nova-ed3135232829794cfbb5a47765f5d078ba9216cf.zip | |
merge trunk
Diffstat (limited to 'bin/stack')
| -rwxr-xr-x | bin/stack | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -59,11 +59,21 @@ USAGE = """usage: stack [options] <controller> <method> [arg1=value arg2=value] def format_help(d): """Format help text, keys are labels and values are descriptions.""" + MAX_INDENT = 30 indent = max([len(k) for k in d]) + if indent > MAX_INDENT: + indent = MAX_INDENT - 6 + out = [] for k, v in d.iteritems(): - t = textwrap.TextWrapper(initial_indent=' %s ' % k.ljust(indent), - subsequent_indent=' ' * (indent + 6)) + if (len(k) + 6) > MAX_INDENT: + out.extend([' %s' % k]) + initial_indent = ' ' * (indent + 6) + else: + initial_indent = ' %s ' % k.ljust(indent) + subsequent_indent = ' ' * (indent + 6) + t = textwrap.TextWrapper(initial_indent=initial_indent, + subsequent_indent=subsequent_indent) out.extend(t.wrap(v)) return out |
