1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00

search: add --repos-baseurl option

This commit is contained in:
Dr. Peter Poeml 2007-08-09 11:35:08 +00:00
parent 2710cca3e0
commit 929fe9b12c
2 changed files with 8 additions and 2 deletions

View File

@ -1549,6 +1549,8 @@ class Osc(cmdln.Cmdln):
print wipebinaries(conf.config['apiurl'], args[0], package, opts.arch, opts.repo, opts.build_disabled)
@cmdln.option('--repos-baseurl', action='store_true',
help='show base URLs of download repositories')
@cmdln.option('-e', '--enable-exact', action='store_true',
help='show only exact matches')
@cmdln.option('--package', action='store_true',
@ -1598,7 +1600,7 @@ class Osc(cmdln.Cmdln):
if not search_for:
search_for = [ 'project', 'package' ]
for kind in search_for:
result = search(conf.config['apiurl'], set(search_list), kind, args[0], opts.verbose, opts.enable_exact)
result = search(conf.config['apiurl'], set(search_list), kind, args[0], opts.verbose, opts.enable_exact, opts.repos_baseurl)
if result:
if kind == 'package':
headline = [ '# Package', '# Project' ]
@ -1606,6 +1608,8 @@ class Osc(cmdln.Cmdln):
headline = [ '# Project' ]
if opts.verbose:
headline.append('# Title')
if opts.repos_baseurl:
headline.append('# URL')
if len(search_for) > 1:
print '#' * 68
print 'matches for \'%s\' in %ss:\n' % (args[0], kind)

View File

@ -1872,7 +1872,7 @@ def build_table(col_num, data = [], headline = [], width=1):
table.append(''.join(row))
return table
def search(apiurl, search_list, kind, search_term, verbose = False, exact_matches = False):
def search(apiurl, search_list, kind, search_term, verbose = False, exact_matches = False, repos_baseurl = False):
"""
Perform a search for 'search_term'. A list which contains the
results will be returned on success otherwise 'None'. If 'verbose' is true
@ -1900,6 +1900,8 @@ def search(apiurl, search_list, kind, search_term, verbose = False, exact_matche
if len(title) > 60:
title = title[:61] + '...'
result.append(title)
if repos_baseurl:
result.append('http://download.opensuse.org/repositories/%s/' % project.replace(':', ':/'))
if result:
return result
else: