Removed less command.

This commit is contained in:
Jeremy Fincher 2003-09-07 06:34:07 +00:00
parent e3148c03fe
commit e53d4e7f87
2 changed files with 1 additions and 33 deletions

View File

@ -720,34 +720,12 @@ class FunCommands(callbacks.Privmsg):
_these = [str(s) for s in this.s.decode('rot13').splitlines() if s]
_these.pop(0)
def zen(self, irc, msg, args):
"""takes no arguments.
"""takes no arguments
Returns one of the zen of Python statements.
"""
irc.reply(msg, random.sample(self._these, 1)[0])
_lesses = {}
def less(self, irc, msg, args):
"""<text>
Deals out <text> in small, IrcMsg-sized pieces. Mostly useful for
piecing-out nested commands.
"""
text = privmsgs.getArgs(args, needed=0, optional=1)
userHostmask = msg.prefix.split('!', 1)[1]
if text:
lines = textwrap.wrap(text, 400)
lines.reverse()
s = lines.pop()
self._lesses[userHostmask] = lines
irc.reply(msg, s)
else:
try:
s = self._lesses[userHostmask].pop()
irc.reply(msg, s)
except (KeyError, IndexError): # Nothing in the list or dict.
irc.error(msg, 'I have no less history for you.')
def dns(self, irc, msg, args):
"""<host|ip>

View File

@ -102,15 +102,5 @@ class FunCommandsTest(PluginTestCase, PluginDocumentation):
self.assertResponse('rpn 1 dup', 'Stack: [1, 1]')
self.assertResponse('rpn 2 3 4 + -', str(2-7))
def testLess(self):
s390 = ' '.join(['123456789']*39)
s790 = ' '.join(['123456789']*79)
self.assertNotError('less %s' % s390)
self.assertError('less')
self.assertNotError('less %s' % s790)
self.assertNotError('less')
self.assertError('less')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: