From 8aadd6e400730ee7418e270fb70a4f8891902593 Mon Sep 17 00:00:00 2001 From: "Dr. Peter Poeml" Date: Tue, 9 Jun 2009 17:07:02 +0000 Subject: [PATCH] osc search: shorten the if branch by eliminating the late else. No functional change should result from this. --- osc/commandline.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 0a44f914..29498d2e 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -2673,11 +2673,15 @@ Please submit there instead, or use --nodevelproject to force direct submission. for kind in search_for: result = search(conf.config['apiurl'], set(search_list), kind, search_term, opts.verbose, opts.exact, opts.repos_baseurl) + if not result: + print 'No matches found for \'%s\' in %ss' % (search_term, kind) + continue + # 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']: + if kind in ['project']: result.sort() - if result and kind in ['package']: + if kind in ['package']: # hm... results is a flat list l = [ (j, i) for i, j in zip(*[iter(result)]*2) ] l.sort() @@ -2685,23 +2689,20 @@ Please submit there instead, or use --nodevelproject to force direct submission. for j, i in l: result.extend([i, j]) - if result: - if kind == 'package': - headline = [ '# Package', '# Project' ] - else: - headline = [ '# Project' ] - if opts.verbose: - headline.append('# Title') - if opts.repos_baseurl: - headline.append('# URL') - if not opts.csv: - if len(search_for) > 1: - print '#' * 68 - print 'matches for \'%s\' in %ss:\n' % (search_term, kind) - for row in build_table(len(headline), result, headline, 2, csv = opts.csv): - print row + if kind == 'package': + headline = [ '# Package', '# Project' ] else: - print 'No matches found for \'%s\' in %ss' % (search_term, kind) + headline = [ '# Project' ] + if opts.verbose: + headline.append('# Title') + if opts.repos_baseurl: + headline.append('# URL') + if not opts.csv: + if len(search_for) > 1: + print '#' * 68 + print 'matches for \'%s\' in %ss:\n' % (search_term, kind) + for row in build_table(len(headline), result, headline, 2, csv = opts.csv): + print row @cmdln.option('-p', '--project', metavar='project',