Provide a default help message for commands without help.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
James McCoy 2013-08-23 22:57:13 -04:00
parent e421722960
commit 333067c151
2 changed files with 8 additions and 1 deletions

View File

@ -214,6 +214,9 @@ def getHelp(method, name=None, doc=None):
if name is None:
name = method.__name__
if doc is None:
if method.__doc__ is None:
doclines = ['This command has no help. Complain to the author.']
else:
doclines = method.__doc__.splitlines()
else:
doclines = doc.splitlines()

View File

@ -550,6 +550,9 @@ class SourceNestedPluginTestCase(PluginTestCase):
"""
irc.reply('f')
def empty(self, irc, msg, args):
pass
class g(callbacks.Commands):
def h(self, irc, msg, args):
"""takes no arguments
@ -588,6 +591,7 @@ class SourceNestedPluginTestCase(PluginTestCase):
self.assertResponse('e g h', 'h')
self.assertResponse('e g i j', 'j')
self.assertHelp('help f')
self.assertHelp('help empty')
self.assertHelp('help same')
self.assertHelp('help e g h')
self.assertHelp('help e g i j')