diff options
| author | termie <github@anarkystic.com> | 2011-03-24 20:45:59 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-03-24 20:45:59 +0000 |
| commit | 823df3b0ee7e7eb35e5864bfa235e686819df13e (patch) | |
| tree | 857ec7ac289584f3803c97edec8fd42fabe5095d /bin/stack | |
| parent | a0ea76b26a7725efb2fc4a811dff66b4f8bff6b7 (diff) | |
| parent | c5cbec20d2785d3060d57b55a264fbf936709500 (diff) | |
Additions to the Direct API:
* Add an example of a versioned api
* Add some more docs to direct.py
* Add Limited, an API limiting/versioning wrapper
* Improve the formatting of the stack tool
* Add support for volume and network services to the direct api
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 |
