Mercurial > piecrust2
diff piecrust/chefutil.py @ 99:8703be118430
Changes to `help` command and extendable commands:
- The `help` command has a prettier output, with descriptions of help
topics.
- `ExtendableChefCommand` is not assuming extensions are sub-commands
anymore.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 13 Sep 2014 14:47:01 -0700 |
parents | 2f717f961996 |
children | 133845647083 |
line wrap: on
line diff
--- a/piecrust/chefutil.py Mon Sep 08 00:04:29 2014 -0700 +++ b/piecrust/chefutil.py Sat Sep 13 14:47:01 2014 -0700 @@ -17,3 +17,16 @@ indent += ' ' ex = ex.__cause__ + +def print_help_item(s, title, description, margin=4, align=25): + s.write(margin * ' ') + s.write(title) + spacer = (align - margin - len(title) - 1) + if spacer <= 0: + s.write("\n") + s.write(' ' * align) + else: + s.write(' ' * spacer) + s.write(description) + s.write("\n") +