mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
supybot-plugin-doc: added support for nested plugins command generation.
This commit is contained in:
parent
fb4ac5de49
commit
0ce71fe405
@ -81,14 +81,26 @@ class PluginDoc(object):
|
||||
log.debug('command: %s', command)
|
||||
self.appendLine(command, 2)
|
||||
self.appendLine('')
|
||||
try:
|
||||
help = inst.getCommandHelp([command])
|
||||
except AssertionError:
|
||||
help = 'nested?'
|
||||
com = getattr(self.mod.Class, command, False)
|
||||
doc = None
|
||||
if com:
|
||||
doc = com.__doc__.splitlines()
|
||||
else:
|
||||
# this is a nested plugin
|
||||
nclass = None
|
||||
try:
|
||||
nroot, nname = command.split()
|
||||
except ValueError:
|
||||
log.warning('Failed to find command, skipping %s', command)
|
||||
break
|
||||
nclass = getattr(self.mod.Class, nroot, False)
|
||||
if nclass:
|
||||
ncom = getattr(nclass, nname, False)
|
||||
doc = ncom.__doc__.splitlines()
|
||||
else:
|
||||
log.warning('Failed to find nested pligun command, skipping %s',
|
||||
command)
|
||||
break
|
||||
if doc:
|
||||
args = doc.pop(0)
|
||||
doc = [l.strip() for l in doc]
|
||||
@ -98,6 +110,7 @@ class PluginDoc(object):
|
||||
self.appendLine('')
|
||||
else:
|
||||
self.appendLine('No help Associated with this command', 3)
|
||||
self.appendLine('')
|
||||
self.appendLine('')
|
||||
return '\n'.join(self.lines)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user