diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2011-03-28 12:13:20 -0500 |
|---|---|---|
| committer | Trey Morris <trey.morris@rackspace.com> | 2011-03-28 12:13:20 -0500 |
| commit | 7eedf3f69ca1bbd1f44252fa01fb4f2676735eb2 (patch) | |
| tree | 33c3983537da1d894caa6b390b5c488511df83c4 /bin/stack | |
| parent | 57890776d0d7e9172b1fa056076ce28ae4b34b7b (diff) | |
| parent | ed12a2cd2beef77d1c7e9d16771e766aa068530d (diff) | |
| download | nova-7eedf3f69ca1bbd1f44252fa01fb4f2676735eb2.tar.gz nova-7eedf3f69ca1bbd1f44252fa01fb4f2676735eb2.tar.xz nova-7eedf3f69ca1bbd1f44252fa01fb4f2676735eb2.zip | |
merge with 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 |
