mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-01 03:50:41 +01:00
Made 'alias foo bar' work as expected.
This commit is contained in:
parent
c1313130a8
commit
f7010805ee
@ -276,6 +276,9 @@ class Alias(callbacks.Privmsg):
|
|||||||
arguments.
|
arguments.
|
||||||
"""
|
"""
|
||||||
(name, alias) = privmsgs.getArgs(args, required=2)
|
(name, alias) = privmsgs.getArgs(args, required=2)
|
||||||
|
if ' ' not in alias:
|
||||||
|
# If it's a single word, they probably want $*.
|
||||||
|
alias += ' $*'
|
||||||
try:
|
try:
|
||||||
self.addAlias(irc, name, alias)
|
self.addAlias(irc, name, alias)
|
||||||
self.log.info('Adding alias %r for %r (from %s)' %
|
self.log.info('Adding alias %r for %r (from %s)' %
|
||||||
|
@ -79,7 +79,7 @@ class AliasTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
|
|
||||||
def testAliasHelp(self):
|
def testAliasHelp(self):
|
||||||
self.assertNotError('alias add slashdot foo')
|
self.assertNotError('alias add slashdot foo')
|
||||||
self.assertRegexp('help slashdot', "Alias for 'foo'")
|
self.assertRegexp('help slashdot', "Alias for 'foo.*'")
|
||||||
|
|
||||||
def testRemove(self):
|
def testRemove(self):
|
||||||
self.assertNotError('alias add foo echo bar')
|
self.assertNotError('alias add foo echo bar')
|
||||||
@ -152,6 +152,10 @@ class AliasTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertNotError('alias add myre "echo s/$1/$2/g"')
|
self.assertNotError('alias add myre "echo s/$1/$2/g"')
|
||||||
self.assertResponse('myre foo bar', 's/foo/bar/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')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user