mirror of https://github.com/Mikaela/Limnoria.git
Utilities: Add @sort.
This commit is contained in:
parent
65a7935214
commit
bfa45a6da8
|
@ -104,6 +104,15 @@ class Utilities(callbacks.Plugin):
|
||||||
irc.reply(' '.join(things))
|
irc.reply(' '.join(things))
|
||||||
shuffle = wrap(shuffle, [many('anything')])
|
shuffle = wrap(shuffle, [many('anything')])
|
||||||
|
|
||||||
|
@internationalizeDocstring
|
||||||
|
def sort(self, irc, msg, args, things):
|
||||||
|
"""<arg> [<arg> ...]
|
||||||
|
|
||||||
|
Sorts the arguments given.
|
||||||
|
"""
|
||||||
|
irc.reply(' '.join(sorted(things)))
|
||||||
|
sort = wrap(sort, [many('anything')])
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def sample(self, irc, msg, args, num, things):
|
def sample(self, irc, msg, args, num, things):
|
||||||
"""<num> <arg> [<arg> ...]
|
"""<num> <arg> [<arg> ...]
|
||||||
|
|
|
@ -62,6 +62,9 @@ class UtilitiesTestCase(PluginTestCase):
|
||||||
def testShuffle(self):
|
def testShuffle(self):
|
||||||
self.assertResponse('shuffle a', 'a')
|
self.assertResponse('shuffle a', 'a')
|
||||||
|
|
||||||
|
def testSort(self):
|
||||||
|
self.assertResponse('sort abc cab cba bca', 'abc bca cab cba')
|
||||||
|
|
||||||
def testSample(self):
|
def testSample(self):
|
||||||
self.assertResponse('sample 1 a', 'a')
|
self.assertResponse('sample 1 a', 'a')
|
||||||
self.assertError('sample moo')
|
self.assertError('sample moo')
|
||||||
|
|
Loading…
Reference in New Issue