diff --git a/plugins/Config/plugin.py b/plugins/Config/plugin.py index 68d81db19..79afb1370 100644 --- a/plugins/Config/plugin.py +++ b/plugins/Config/plugin.py @@ -206,6 +206,24 @@ class Config(callbacks.Plugin): irc.reply(_('There were no matching configuration variables.')) search = wrap(search, ['lowered']) # XXX compose with withoutSpaces? + @internationalizeDocstring + def searchvalues(self, irc, msg, args, word): + """ + + Searches for in the values of current configuration variables. + """ + L = [] + for (name, x) in conf.supybot.getValues(getChildren=True): + if (hasattr(x, 'value') # not a group + and word in str(x()).lower()): + last_name_part = registry.split(name)[-1] + L.append(name) + if L: + irc.reply(format('%L', L)) + else: + irc.reply(_('There were no matching configuration variables.')) + searchvalues = wrap(searchvalues, ['lowered']) + def _getValue(self, irc, msg, group, network=None, channel=None, addGlobal=False): global_group = group global_value = str(group) or ' ' diff --git a/plugins/Config/test.py b/plugins/Config/test.py index 6d19a319f..bad6862bf 100644 --- a/plugins/Config/test.py +++ b/plugins/Config/test.py @@ -83,10 +83,21 @@ class ConfigTestCase(ChannelPluginTestCase): self.assertNotError('config help %s' % name) def testSearch(self): - self.assertNotError('config search chars') + self.assertRegexp( + 'config search chars', 'supybot.reply.whenAddressedBy.chars') self.assertNotError('config channel reply.whenAddressedBy.chars @') self.assertNotRegexp('config search chars', self.channel) + def testSearchValues(self): + self.assertResponse( + 'config searchvalues @@@', + 'There were no matching configuration variables.') + self.assertNotError('config channel reply.whenAddressedBy.strings @@@') + self.assertResponse( + 'config searchvalues @@@', + r'supybot.reply.whenAddressedBy.strings.#test and ' + r'supybot.reply.whenAddressedBy.strings.\:test.#test') + def testDefault(self): self.assertNotError('config default ' 'supybot.replies.genericNoCapability')