diff options
| author | Cory Wright <cory.wright@rackspace.com> | 2011-03-25 15:10:56 +0000 |
|---|---|---|
| committer | Cory Wright <cory.wright@rackspace.com> | 2011-03-25 15:10:56 +0000 |
| commit | 4c510d588d4a67a549f5a544f7fa64f97c0022c7 (patch) | |
| tree | a1d02c453b31af713cfad4bad85d47bd29f07cb0 /bin/stack | |
| parent | 4183eabb7ca46735ab6b87b1469ff089c4f19cb4 (diff) | |
| parent | 162af7b79631b151f03bb46773a1448e6c051325 (diff) | |
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 |
