mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +01:00
Added Utilities.last.
This commit is contained in:
parent
dfe1743dac
commit
e50f3ccbac
@ -1,3 +1,7 @@
|
|||||||
|
* Added Utilities.last, which replies with the last string
|
||||||
|
given. This is useful for sequencing commands and then replying
|
||||||
|
with the output of the last commnad.
|
||||||
|
|
||||||
* Updated RSS.info to accept a feed name as well as a url.
|
* Updated RSS.info to accept a feed name as well as a url.
|
||||||
|
|
||||||
* Added a signal handler for SIGTERM, so you folks killing your
|
* Added a signal handler for SIGTERM, so you folks killing your
|
||||||
|
@ -64,6 +64,18 @@ class Utilities(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
|
|
||||||
|
def last(self, irc, msg, args):
|
||||||
|
"""<text> [<text> ...]
|
||||||
|
|
||||||
|
Returns the last argument given. Useful when you'd like multiple
|
||||||
|
nested commands to run, but only the output of the last one to be
|
||||||
|
returned.
|
||||||
|
"""
|
||||||
|
if args:
|
||||||
|
irc.reply(args[-1])
|
||||||
|
else:
|
||||||
|
raise callbacks.Error
|
||||||
|
|
||||||
def strjoin(self, irc, msg, args):
|
def strjoin(self, irc, msg, args):
|
||||||
"""<separator> <string 1> [<string> ...]
|
"""<separator> <string 1> [<string> ...]
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@ class UtilitiesTestCase(PluginTestCase):
|
|||||||
self.assertNotError('success 1')
|
self.assertNotError('success 1')
|
||||||
self.assertError('success [re m/foo bar]')
|
self.assertError('success [re m/foo bar]')
|
||||||
|
|
||||||
|
def testLast(self):
|
||||||
|
self.assertResponse('utilities last foo bar baz', 'baz')
|
||||||
|
|
||||||
def testStrjoin(self):
|
def testStrjoin(self):
|
||||||
self.assertResponse('strjoin + foo bar baz', 'foo+bar+baz')
|
self.assertResponse('strjoin + foo bar baz', 'foo+bar+baz')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user