diff --git a/PkgInfo/plugin.py b/PkgInfo/plugin.py index 433ea7c..53b9650 100644 --- a/PkgInfo/plugin.py +++ b/PkgInfo/plugin.py @@ -294,13 +294,17 @@ class PkgInfo(callbacks.Plugin): irc.error("No results found.", Raise=True) archaur = wrap(archaur, ['somethingWithoutSpaces']) - def pkgsearch(self, irc, msg, args, distro, query): - """ + def pkgsearch(self, irc, msg, args, opts, query): + """[--distro ] Looks up in 's website (for Debian/Ubuntu).""" - distro = distro.lower() - if distro not in ("debian", "ubuntu"): - distro = self._getDistro(distro) + opts = dict(opts) + if 'distro' not in opts: + distro = 'debian' + else: + distro = opts['distro'].lower() + if distro not in ("debian", "ubuntu"): + distro = self._getDistro(distro) try: url = '%ssearch?keywords=%s' % (self.addrs[distro], quote(query)) except KeyError: @@ -332,7 +336,7 @@ class PkgInfo(callbacks.Plugin): except AttributeError: e = "No results found." irc.error(e) - pkgsearch = wrap(pkgsearch, ['somethingWithoutSpaces', + pkgsearch = wrap(pkgsearch, [getopts({'distro': 'somethingWithoutSpaces'}), 'somethingWithoutSpaces']) def mintpkg(self, irc, msg, args, release, query, opts): diff --git a/PkgInfo/test.py b/PkgInfo/test.py index d7435c4..d058117 100644 --- a/PkgInfo/test.py +++ b/PkgInfo/test.py @@ -63,6 +63,7 @@ class PkgInfoTestCase(PluginTestCase): self.assertNotError('mintpkg qiana cinnamon') def testPkgsearch(self): - self.assertNotError('pkgsearch debian python') + self.assertNotError('pkgsearch --distro ubuntu python') + self.assertNotError('pkgsearch python') # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: