fix help display when there is no doc
authorAlexander Solovyov <alexander@solovyov.net>
Sun, 23 Jan 2011 18:02:33 +0100
changeset 160 82b562890ed7
parent 159 053f4635877b
child 161 876a22f3d154
fix help display when there is no doc
opster.py
tests/multicommands.py
tests/opster.t
--- a/opster.py	Thu Jan 06 20:34:09 2011 +0100
+++ b/opster.py	Sun Jan 23 18:02:33 2011 +0100
@@ -182,8 +182,8 @@
                 if shortlist and not cmd.startswith('^'):
                     continue  # short help contains only marked commands
                 cmd = cmd.lstrip('^~')
-                doc = info[0].__doc__.strip() or '(no help text available)'
-                hlp[cmd] = doc.splitlines()[0].rstrip()
+                doc = info[0].__doc__ or '(no help text available)'
+                hlp[cmd] = doc.strip().splitlines()[0].rstrip()
 
             hlplist = sorted(hlp)
             maxlen = max(map(len, hlplist))
--- a/tests/multicommands.py	Thu Jan 06 20:34:09 2011 +0100
+++ b/tests/multicommands.py	Sun Jan 23 18:02:33 2011 +0100
@@ -38,6 +38,10 @@
     if opts.get('exit'):
         sys.exit(opts['exit'])
 
+@command(shortlist=True)
+def nodoc():
+    pass
+
 def ui_middleware(func):
     def extract_dict(source, *keys):
         dest = {}
--- a/tests/opster.t	Thu Jan 06 20:34:09 2011 +0100
+++ b/tests/opster.t	Sun Jan 23 18:02:33 2011 +0100
@@ -31,6 +31,7 @@
   
   commands:
   
+   nodoc   (no help text available)
    simple  Just simple command to print keys of received arguments.