mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Aka: add 'aka list --keys'
This allows one to view just the list of Akas without their commands, similar to the older 'list aka' behavior.
This commit is contained in:
parent
dd818f6e7e
commit
5bd2c5eaaf
@ -711,10 +711,11 @@ class Aka(callbacks.Plugin):
|
||||
importaliasdatabase = wrap(importaliasdatabase, ['owner'])
|
||||
|
||||
def list(self, irc, msg, args, optlist):
|
||||
"""[--channel <#channel>]
|
||||
"""[--channel <#channel>] [--keys]
|
||||
|
||||
Lists all Akas defined for <channel>. If <channel> is not specified,
|
||||
lists all global Akas."""
|
||||
lists all global Akas. If --keys is given, lists only the Aka names
|
||||
and not their commands."""
|
||||
channel = 'global'
|
||||
for (option, arg) in optlist:
|
||||
if option == 'channel':
|
||||
@ -724,13 +725,18 @@ class Aka(callbacks.Plugin):
|
||||
channel = arg
|
||||
aka_list = self._db.get_aka_list(channel)
|
||||
if aka_list:
|
||||
aka_values = [self._db.get_alias(channel, aka) for aka in aka_list]
|
||||
s = ('{0}: "{1}"'.format(ircutils.bold(k), v) for (k, v) in
|
||||
zip(aka_list, aka_values))
|
||||
if 'keys' in dict(optlist):
|
||||
# Strange, aka_list is a list of one length tuples
|
||||
s = [k[0] for k in aka_list]
|
||||
else:
|
||||
aka_values = [self._db.get_alias(channel, aka) for aka in
|
||||
aka_list]
|
||||
s = ('{0}: "{1}"'.format(ircutils.bold(k), v) for (k, v) in
|
||||
zip(aka_list, aka_values))
|
||||
irc.replies(s)
|
||||
else:
|
||||
irc.error(_("No Akas found."))
|
||||
list = wrap(list, [getopts({'channel': 'channel'})])
|
||||
list = wrap(list, [getopts({'channel': 'channel', 'keys': ''})])
|
||||
|
||||
|
||||
Class = Aka
|
||||
|
Loading…
Reference in New Issue
Block a user