diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-03-25 09:11:13 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-03-25 09:11:13 -0400 |
| commit | 0236c12d37dc100ee6a5f1a40d6a6d33e86695a8 (patch) | |
| tree | 49e55673c8e6134f66c4ea45aa5351bacf45eda3 /bin/stack | |
| parent | f5b2167c3a18097a0de0c5b26a63baad7c1904a1 (diff) | |
| parent | 0215ca743bb96caf4ccb3c8c4fbb1b680d747d57 (diff) | |
merging trunk and resolving conflicts
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 |
