mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Removed --fancy option; made True the default.
This commit is contained in:
parent
d1e049cb04
commit
bb231a19e5
16
src/Misc.py
16
src/Misc.py
@ -274,7 +274,7 @@ class Misc(callbacks.Privmsg):
|
||||
ircutils.isChannel(msg.args[0])
|
||||
|
||||
def last(self, irc, msg, args):
|
||||
"""[--{from,in,to,with,regexp,fancy}] <args>
|
||||
"""[--{from,in,to,with,regexp}] <args>
|
||||
|
||||
Returns the last message matching the given criteria. --from requires
|
||||
a nick from whom the message came; --in and --to require a channel the
|
||||
@ -283,15 +283,12 @@ class Misc(callbacks.Privmsg):
|
||||
--fancy determines whether or not to show the nick; the default is not
|
||||
"""
|
||||
(optlist, rest) = getopt.getopt(args, '', ['from=', 'in=', 'to=',
|
||||
'with=', 'regexp=',
|
||||
'fancy'])
|
||||
fancy = False
|
||||
'with=', 'regexp='])
|
||||
|
||||
predicates = []
|
||||
for (option, arg) in optlist:
|
||||
option = option.strip('-')
|
||||
if option == 'fancy':
|
||||
fancy = True
|
||||
elif option == 'from':
|
||||
if option == 'from':
|
||||
predicates.append(lambda m, arg=arg: \
|
||||
ircutils.hostmaskPatternEqual(arg, m.nick))
|
||||
elif option == 'in' or option == 'to':
|
||||
@ -317,10 +314,7 @@ class Misc(callbacks.Privmsg):
|
||||
if not predicate(m):
|
||||
break
|
||||
else:
|
||||
if fancy:
|
||||
irc.reply(msg, ircmsgs.prettyPrint(m))
|
||||
else:
|
||||
irc.reply(msg, m.args[1])
|
||||
irc.reply(msg, ircmsgs.prettyPrint(m))
|
||||
return
|
||||
irc.error(msg, 'I couldn\'t find a message matching that criteria.')
|
||||
|
||||
|
@ -116,15 +116,17 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
|
||||
def testLast(self):
|
||||
self.feedMsg('foo bar baz')
|
||||
self.assertResponse('last', 'foo bar baz')
|
||||
self.assertRegexp('last', 'last')
|
||||
self.assertResponse('last --with foo', 'foo bar baz')
|
||||
self.assertResponse('last', '<%s> foo bar baz' % self.nick)
|
||||
self.assertRegexp('last', '<%s> @last' % self.nick)
|
||||
self.assertResponse('last --with foo', '<%s> foo bar baz' % self.nick)
|
||||
self.assertRegexp('last --regexp m/\s+/', 'last --with foo')
|
||||
self.assertResponse('last --regexp m/bar/', 'foo bar baz')
|
||||
self.assertResponse('last --regexp m/bar/',
|
||||
'<%s> foo bar baz' % self.nick)
|
||||
self.assertResponse('last --from %s' % self.nick.upper(),
|
||||
'@last --regexp m/bar/')
|
||||
'<%s> @last --regexp m/bar/' % self.nick)
|
||||
self.assertResponse('last --from %s*' % self.nick[0],
|
||||
'@last --from %s' % self.nick.upper())
|
||||
'<%s> @last --from %s' %
|
||||
(self.nick, self.nick.upper()))
|
||||
|
||||
def testMore(self):
|
||||
self.assertRegexp('echo %s' % ('abc'*300), 'more')
|
||||
|
Loading…
Reference in New Issue
Block a user