Added Utilities.last.

This commit is contained in:
Jeremy Fincher 2004-04-22 03:39:38 +00:00
parent dfe1743dac
commit e50f3ccbac
3 changed files with 19 additions and 0 deletions

View File

@ -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.
* Added a signal handler for SIGTERM, so you folks killing your

View File

@ -64,6 +64,18 @@ class Utilities(callbacks.Privmsg):
"""
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):
"""<separator> <string 1> [<string> ...]

View File

@ -41,6 +41,9 @@ class UtilitiesTestCase(PluginTestCase):
self.assertNotError('success 1')
self.assertError('success [re m/foo bar]')
def testLast(self):
self.assertResponse('utilities last foo bar baz', 'baz')
def testStrjoin(self):
self.assertResponse('strjoin + foo bar baz', 'foo+bar+baz')