diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-04-05 12:55:57 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-04-05 12:55:57 -0700 |
| commit | b66535602eae6b2f91cc5573798cd837e63f8ecc (patch) | |
| tree | ecec28580523826f8315c226af32e4880478e7cf /bin/stack | |
| parent | e0ba72946011b67a218e3c619b3105529bb43e53 (diff) | |
| parent | 94ccd2f4a1c42a8574fe65972650428130ae850d (diff) | |
| download | nova-b66535602eae6b2f91cc5573798cd837e63f8ecc.tar.gz nova-b66535602eae6b2f91cc5573798cd837e63f8ecc.tar.xz nova-b66535602eae6b2f91cc5573798cd837e63f8ecc.zip | |
merged 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 |
