Skip to content

Commit

Permalink
Utilities: Add @sort.
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Mar 20, 2014
1 parent 65a7935 commit bfa45a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/Utilities/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ def shuffle(self, irc, msg, args, things):
irc.reply(' '.join(things))
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
def sample(self, irc, msg, args, num, things):
"""<num> <arg> [<arg> ...]
Expand Down
3 changes: 3 additions & 0 deletions plugins/Utilities/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def testApply(self):
def testShuffle(self):
self.assertResponse('shuffle a', 'a')

def testSort(self):
self.assertResponse('sort abc cab cba bca', 'abc bca cab cba')

def testSample(self):
self.assertResponse('sample 1 a', 'a')
self.assertError('sample moo')
Expand Down

0 comments on commit bfa45a6

Please sign in to comment.