diff options
| author | John Tran <jtran@attinteractive.com> | 2011-05-12 14:29:41 -0700 |
|---|---|---|
| committer | John Tran <jtran@attinteractive.com> | 2011-05-12 14:29:41 -0700 |
| commit | cbe89f150f6c1e209405da6cbba4c3cf9163fd2e (patch) | |
| tree | 3d3f3415257b2f2d266137cd06c29b62e97b96d1 /bin/stack | |
| parent | 7cd6e9f1cf62ff5628ae4680aa66ada676c8c288 (diff) | |
| parent | 0576766cdf3480ad02159671d2dfc0bdcb154934 (diff) | |
| download | nova-cbe89f150f6c1e209405da6cbba4c3cf9163fd2e.tar.gz nova-cbe89f150f6c1e209405da6cbba4c3cf9163fd2e.tar.xz nova-cbe89f150f6c1e209405da6cbba4c3cf9163fd2e.zip | |
merged from 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 |
