summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-12-19 19:51:35 +0000
committerLars Wirzenius <liw@liw.fi>2011-12-19 19:51:35 +0000
commit81a16738fff9aa3612d5f9e4550d3b695a0d09f1 (patch)
treea5aa9b46b4dfaf1440b7f05c17ff28215dec210d
parentb35d20142fb88795ed757611ae7416a67712e028 (diff)
downloadcliapp-81a16738fff9aa3612d5f9e4550d3b695a0d09f1.tar.gz
format subcommand descriptions in --help better
-rw-r--r--cliapp/app.py8
-rw-r--r--example2.py7
2 files changed, 11 insertions, 4 deletions
diff --git a/cliapp/app.py b/cliapp/app.py
index 76d2a9b..f5d3b77 100644
--- a/cliapp/app.py
+++ b/cliapp/app.py
@@ -242,13 +242,15 @@ class Application(object):
lines = doc.splitlines()
remove_empties(lines)
if lines:
- result = ['* %s: %s' % (cmd, lines[0])]
+ heading = '* %s -- %s' % (cmd, lines[0])
+ result = [heading]
del lines[0]
remove_empties(lines)
while lines:
- para = split_para(lines)
result.append('')
- result.append(indent + (' '.join(para)))
+ para_lines = split_para(lines)
+ para_text = ' '.join(para_lines)
+ result.append(para_text)
remove_empties(lines)
return '\n'.join(result)
else:
diff --git a/example2.py b/example2.py
index 907fb59..f766d34 100644
--- a/example2.py
+++ b/example2.py
@@ -44,7 +44,12 @@ class ExampleApp(cliapp.Application):
self.output.write('greetings, %s\n' % arg)
def cmd_insult(self, args):
- '''Insult the user.'''
+ '''Insult the user.
+
+ Sometimes, though rarely, it happens that a user is really a bit of
+ a prat, and needs to be told off. This is the command for that.
+
+ '''
for arg in args:
self.output.write('you suck, %s\n' % arg)