Update supybot-plugin-doc to work with current version of the registry.

Closes GH-1388.
This commit is contained in:
Valentin Lorentz 2019-12-09 21:34:21 +01:00
parent a86df1fc35
commit 130ceede57

View File

@ -146,10 +146,12 @@ class PluginDoc(object):
self.appendLine('No configuration for this plugin') self.appendLine('No configuration for this plugin')
else: else:
for confValues in self.genConfig(confs, 0): for confValues in self.genConfig(confs, 0):
(name, isChan, help, default, indent) = confValues (name, isChan, isNet, help, default, indent) = confValues
self.appendLine('%s' % name, indent - 1) self.appendLine('%s' % name, indent - 1)
self.appendLine('This config variable defaults to %s and %s ' self.appendLine(
'channel specific.' % (default,isChan), indent) ('This config variable defaults to %s, '
'is%s network-specific, and is %s channel-specific.')
% (default, isNet, isChan), indent)
self.lines.append('') self.lines.append('')
self.appendLine(help, indent) self.appendLine(help, indent)
self.lines.append('') self.lines.append('')
@ -194,10 +196,12 @@ class PluginDoc(object):
self.appendLine('No configuration for this plugin', 2) self.appendLine('No configuration for this plugin', 2)
else: else:
for confValues in self.genConfig(confs, 2): for confValues in self.genConfig(confs, 2):
(name, isChan, help, default, indent) = confValues (name, isChan, isNet, help, default, indent) = confValues
self.appendLine('* %s' % name, indent - 1) self.appendLine('* %s' % name, indent - 1)
self.appendLine('This config variable defaults to %s and %s ' self.appendLine(
'channel specific.' % (default,isChan), indent) ('This config variable defaults to %s, '
'is%s network-specific, and is %s channel-specific.')
% (default, isNet, isChan), indent)
self.appendLine(help, indent) self.appendLine(help, indent)
return '\n'.join(self.lines) + '\n' return '\n'.join(self.lines) + '\n'
@ -206,22 +210,22 @@ class PluginDoc(object):
if not confVars: if not confVars:
return return
for (c, v) in confVars: for (c, v) in confVars:
if not isinstance(v, registry.Value):
# Don't log groups
continue
name = v._name name = v._name
indent = origindent + 1 indent = origindent + 1
try: try:
default = str(v) default = str(v)
if isinstance(v._default, basestring) or v._default is None: if not isinstance(v._default, basestring):
default = utils.str.dqrepr(default) default = utils.str.dqrepr(default)
help = v.help() help = v.help()
channelValue = v.channelValue
except registry.NonExistentRegistryEntry: except registry.NonExistentRegistryEntry:
pass pass
else: else:
if channelValue: cv = '' if v._channelValue else ' not'
cv = 'is' nv = '' if v._networkValue else ' not'
else: yield (name, cv, nv, help, default, indent)
cv = 'is not'
yield (name, cv, help, default, indent)
for confValues in self.genConfig(v, indent): for confValues in self.genConfig(v, indent):
yield confValues yield confValues