From fc11ff4f241f34ab1625655a203dd762873cefe7 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 27 Oct 2003 04:59:54 +0000 Subject: [PATCH] Handle properly the case where no matching commands were found. --- src/Misc.py | 7 +++++-- test/test_Misc.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Misc.py b/src/Misc.py index 3ef471c19..57e973e1c 100755 --- a/src/Misc.py +++ b/src/Misc.py @@ -180,8 +180,11 @@ class Misc(callbacks.Privmsg): else: for name in names: L.append('%s %s' % (name, key)) - L.sort() - irc.reply(msg, utils.commaAndify(L)) + if L: + L.sort() + irc.reply(msg, utils.commaAndify(L)) + else: + irc.error(msg, 'No appropriate commands were found.') def help(self, irc, msg, args): """[] diff --git a/test/test_Misc.py b/test/test_Misc.py index 31a95d9f3..843c14b2c 100644 --- a/test/test_Misc.py +++ b/test/test_Misc.py @@ -142,6 +142,7 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation): def testApropos(self): self.assertNotError('apropos f') + self.assertError('apropos asldkfjasdlkfja')