mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-29 03:06:15 +01:00
osc search: sort search results.
This commit is contained in:
parent
4c73a41e7b
commit
51726bb28b
@ -2672,6 +2672,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
search_for = [ 'project', 'package' ]
|
search_for = [ 'project', 'package' ]
|
||||||
for kind in search_for:
|
for kind in search_for:
|
||||||
result = search(conf.config['apiurl'], set(search_list), kind, search_term, opts.verbose, opts.exact, opts.repos_baseurl)
|
result = search(conf.config['apiurl'], set(search_list), kind, search_term, opts.verbose, opts.exact, opts.repos_baseurl)
|
||||||
|
|
||||||
|
# unfortunately, there is no sort support in the api.
|
||||||
|
# we can do it here. Maybe it would be better done in osc.core.search() already.
|
||||||
|
if result and kind in ['project']:
|
||||||
|
result.sort()
|
||||||
|
if result and kind in ['package']:
|
||||||
|
# hm... results is a flat list
|
||||||
|
l = [ (j, i) for i, j in zip(*[iter(result)]*2) ]
|
||||||
|
l.sort()
|
||||||
|
result = []
|
||||||
|
for j, i in l:
|
||||||
|
result.extend([i, j])
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
if kind == 'package':
|
if kind == 'package':
|
||||||
headline = [ '# Package', '# Project' ]
|
headline = [ '# Package', '# Project' ]
|
||||||
|
Loading…
Reference in New Issue
Block a user