Made 'alias foo bar' work as expected.

This commit is contained in:
Jeremy Fincher 2004-04-20 11:28:03 +00:00
parent c1313130a8
commit f7010805ee
2 changed files with 8 additions and 1 deletions

View File

@ -276,6 +276,9 @@ class Alias(callbacks.Privmsg):
arguments.
"""
(name, alias) = privmsgs.getArgs(args, required=2)
if ' ' not in alias:
# If it's a single word, they probably want $*.
alias += ' $*'
try:
self.addAlias(irc, name, alias)
self.log.info('Adding alias %r for %r (from %s)' %

View File

@ -79,7 +79,7 @@ class AliasTestCase(ChannelPluginTestCase, PluginDocumentation):
def testAliasHelp(self):
self.assertNotError('alias add slashdot foo')
self.assertRegexp('help slashdot', "Alias for 'foo'")
self.assertRegexp('help slashdot', "Alias for 'foo.*'")
def testRemove(self):
self.assertNotError('alias add foo echo bar')
@ -151,6 +151,10 @@ class AliasTestCase(ChannelPluginTestCase, PluginDocumentation):
def testNoExtraQuotes(self):
self.assertNotError('alias add myre "echo s/$1/$2/g"')
self.assertResponse('myre foo bar', 's/foo/bar/g')
def testSimpleAliasWithoutArgsImpliesDollarStar(self):
self.assertNotError('alias add exo echo')
self.assertResponse('exo foo bar baz', 'foo bar baz')