Made --private only show private plugins.

This commit is contained in:
Jeremy Fincher 2004-07-28 04:27:51 +00:00
parent 79bb9029ef
commit 46383f9fc7

View File

@ -74,20 +74,22 @@ class Misc(callbacks.Privmsg):
Lists the commands available in the given plugin. If no plugin is Lists the commands available in the given plugin. If no plugin is
given, lists the public plugins available. If --private is given, given, lists the public plugins available. If --private is given,
lists all commands, not just the public ones. lists the private plugins.
""" """
(optlist, rest) = getopt.getopt(args, '', ['private']) (optlist, rest) = getopt.getopt(args, '', ['private'])
evenPrivate = False private = False
for (option, argument) in optlist: for (option, argument) in optlist:
if option == '--private': if option == '--private':
evenPrivate = True private = True
name = privmsgs.getArgs(rest, required=0, optional=1) name = privmsgs.getArgs(rest, required=0, optional=1)
name = callbacks.canonicalName(name) name = callbacks.canonicalName(name)
if not name: if not name:
def isPublic(cb): def isPublic(cb):
name = cb.name() name = cb.name()
return conf.supybot.plugins.get(name).public() or evenPrivate return conf.supybot.plugins.get(name).public()
names = [cb.name() for cb in irc.callbacks if isPublic(cb)] names = [cb.name() for cb in irc.callbacks
if (private and not isPublic(cb)) or
(not private and isPublic(cb))]
names.sort() names.sort()
irc.reply(utils.commaAndify(names)) irc.reply(utils.commaAndify(names))
else: else: