mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-30 07:21:12 -05:00
PkgInfo: in pkgsearch, make <distro> optional
This commit is contained in:
parent
8f78bb28c0
commit
3e1960a51e
@ -294,11 +294,15 @@ class PkgInfo(callbacks.Plugin):
|
||||
irc.error("No results found.", Raise=True)
|
||||
archaur = wrap(archaur, ['somethingWithoutSpaces'])
|
||||
|
||||
def pkgsearch(self, irc, msg, args, distro, query):
|
||||
"""<distro> <query>
|
||||
def pkgsearch(self, irc, msg, args, opts, query):
|
||||
"""[--distro <distro>] <query>
|
||||
|
||||
Looks up <query> in <distro>'s website (for Debian/Ubuntu)."""
|
||||
distro = distro.lower()
|
||||
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:
|
||||
@ -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):
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user