* improve the code of search command a bit
This commit is contained in:
@@ -975,9 +975,15 @@ Finds a package in repository containing specified search terms
|
|||||||
lang = 'en'
|
lang = 'en'
|
||||||
return lang
|
return lang
|
||||||
|
|
||||||
|
def search_package(terms, lang = None):
|
||||||
|
if not lang:
|
||||||
|
lang = pisi.pxml.autoxml.LocalText.get_lang()
|
||||||
def search(self, id, terms):
|
def search(self, id, terms):
|
||||||
lang = self.get_lang()
|
|
||||||
return pisi.search.query(id, lang, terms)
|
return pisi.search.query(id, lang, terms)
|
||||||
|
r1 = pisi.search.query('summary', lang, terms)
|
||||||
|
r2 = pisi.search.query('description', lang, terms)
|
||||||
|
r = r1.union(r2)
|
||||||
|
return r
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
@@ -987,9 +993,7 @@ Finds a package in repository containing specified search terms
|
|||||||
self.help()
|
self.help()
|
||||||
return
|
return
|
||||||
|
|
||||||
r1 = self.search('summary', self.args)
|
r = search_package(self.args, self.get_lang())
|
||||||
r2 = self.search('description', self.args)
|
|
||||||
r = r1.union(r2)
|
|
||||||
|
|
||||||
for pkg in r:
|
for pkg in r:
|
||||||
self.printinfo_package(pkg)
|
self.printinfo_package(pkg)
|
||||||
|
|||||||
Reference in New Issue
Block a user