mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-02 07:34:08 +01:00
supybot-plugin-doc: Clean up generation of config docs
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
178f70f946
commit
406736524b
@ -117,7 +117,6 @@ class PluginDoc(object):
|
|||||||
if len(commands):
|
if len(commands):
|
||||||
self.appendLine('Commands')
|
self.appendLine('Commands')
|
||||||
self.appendLine('--------')
|
self.appendLine('--------')
|
||||||
self.lines.append('')
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
log.debug('command: %s', command)
|
log.debug('command: %s', command)
|
||||||
line = '%s ' % command
|
line = '%s ' % command
|
||||||
@ -135,15 +134,22 @@ class PluginDoc(object):
|
|||||||
self.appendLine('No help associated with this command')
|
self.appendLine('No help associated with this command')
|
||||||
self.lines.append('')
|
self.lines.append('')
|
||||||
# now the config
|
# now the config
|
||||||
self.appendLine('Configuration')
|
|
||||||
self.appendLine('-------------')
|
|
||||||
try:
|
try:
|
||||||
confs = conf.supybot.plugins.get(self.name)
|
confs = conf.supybot.plugins.get(self.name)
|
||||||
|
self.appendLine('Configuration')
|
||||||
|
self.appendLine('-------------')
|
||||||
except registry.NonExistentRegistryEntry:
|
except registry.NonExistentRegistryEntry:
|
||||||
log.info('No configuration for plugin %s', plugin)
|
log.info('No configuration for plugin %s', plugin)
|
||||||
self.appendLine('No help configuration with this plugin')
|
self.appendLine('No configuration for this plugin')
|
||||||
else:
|
else:
|
||||||
self.genConfig(confs, 2)
|
for confValues in self.genConfig(confs, 0):
|
||||||
|
(name, isChan, help, default, indent) = confValues
|
||||||
|
self.appendLine('%s' % name, indent - 1)
|
||||||
|
self.appendLine('This config variable defaults to %s and %s '
|
||||||
|
'channel specific.' % (default,isChan), indent)
|
||||||
|
self.lines.append('')
|
||||||
|
self.appendLine(help, indent)
|
||||||
|
self.lines.append('')
|
||||||
return '\n'.join(self.lines) + '\n'
|
return '\n'.join(self.lines) + '\n'
|
||||||
|
|
||||||
def renderSTX(self):
|
def renderSTX(self):
|
||||||
@ -177,14 +183,19 @@ class PluginDoc(object):
|
|||||||
else:
|
else:
|
||||||
self.appendLine('No help associated with this command', 3)
|
self.appendLine('No help associated with this command', 3)
|
||||||
# now the config
|
# now the config
|
||||||
self.appendLine('Configuration', 1)
|
|
||||||
try:
|
try:
|
||||||
confs = conf.supybot.plugins.get(self.name)
|
confs = conf.supybot.plugins.get(self.name)
|
||||||
|
self.appendLine('Configuration', 1)
|
||||||
except registry.NonExistentRegistryEntry:
|
except registry.NonExistentRegistryEntry:
|
||||||
log.info('No configuration for plugin %s', plugin)
|
log.info('No configuration for plugin %s', plugin)
|
||||||
self.appendLine('No help configuration with this plugin', 2)
|
self.appendLine('No configuration for this plugin', 2)
|
||||||
else:
|
else:
|
||||||
self.genConfig(confs, 2)
|
for confValues in self.genConfig(confs, 2):
|
||||||
|
(name, isChan, help, default, indent) = confValues
|
||||||
|
self.appendLine('* %s' % name, indent - 1)
|
||||||
|
self.appendLine('This config variable defaults to %s and %s '
|
||||||
|
'channel specific.' % (default,isChan), indent)
|
||||||
|
self.appendLine(help, indent)
|
||||||
return '\n'.join(self.lines) + '\n'
|
return '\n'.join(self.lines) + '\n'
|
||||||
|
|
||||||
def genConfig(self, item, origindent):
|
def genConfig(self, item, origindent):
|
||||||
@ -192,8 +203,7 @@ class PluginDoc(object):
|
|||||||
if not confVars:
|
if not confVars:
|
||||||
return
|
return
|
||||||
for (c, v) in confVars:
|
for (c, v) in confVars:
|
||||||
name = '* %s' % v._name
|
name = v._name
|
||||||
self.appendLine(name, origindent)
|
|
||||||
indent = origindent + 1
|
indent = origindent + 1
|
||||||
try:
|
try:
|
||||||
default = str(v)
|
default = str(v)
|
||||||
@ -208,10 +218,9 @@ class PluginDoc(object):
|
|||||||
cv = 'is'
|
cv = 'is'
|
||||||
else:
|
else:
|
||||||
cv = 'is not'
|
cv = 'is not'
|
||||||
self.appendLine('This config variable defaults to %s and %s '
|
yield (name, cv, help, default, indent)
|
||||||
'channel specific.' % (default, cv), indent)
|
for confValues in self.genConfig(v, indent):
|
||||||
self.appendLine(help, indent)
|
yield confValues
|
||||||
self.genConfig(v, indent)
|
|
||||||
|
|
||||||
def genDoc(m, options):
|
def genDoc(m, options):
|
||||||
Plugin = PluginDoc(m)
|
Plugin = PluginDoc(m)
|
||||||
|
Loading…
Reference in New Issue
Block a user