1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-12 08:56:13 +01:00

osc results: Add support for --format for default text mode

This commit is contained in:
Marcos Bjoerkelund 2024-06-14 13:56:00 +02:00 committed by Daniel Mach
parent 088a4678ba
commit e2f164336d
2 changed files with 9 additions and 3 deletions

View File

@ -6055,7 +6055,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('', '--csv', action='store_true', default=False, @cmdln.option('', '--csv', action='store_true', default=False,
help='generate output in CSV format') help='generate output in CSV format')
@cmdln.option('', '--format', default='%(repository)s|%(arch)s|%(state)s|%(dirty)s|%(code)s|%(details)s', @cmdln.option('', '--format', default='%(repository)s|%(arch)s|%(state)s|%(dirty)s|%(code)s|%(details)s',
help='format string for csv output') help='format string for default or csv output (not supported for xml)')
@cmdln.option('--show-excluded', action='store_true', @cmdln.option('--show-excluded', action='store_true',
help='show repos that are excluded for this package') help='show repos that are excluded for this package')
def do_results(self, subcmd, opts, *args): def do_results(self, subcmd, opts, *args):
@ -6129,6 +6129,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
kwargs['verbose'] = opts.verbose kwargs['verbose'] = opts.verbose
kwargs['wait'] = opts.watch kwargs['wait'] = opts.watch
kwargs['printJoin'] = '\n' kwargs['printJoin'] = '\n'
kwargs['format'] = opts.format
get_results(**kwargs) get_results(**kwargs)
# WARNING: this function is also called by do_results. You need to set a default there # WARNING: this function is also called by do_results. You need to set a default there

View File

@ -4101,8 +4101,13 @@ def get_results(apiurl: str, project: str, package: str, verbose=False, printJoi
# hmm the function name is a bit too generic - something like # hmm the function name is a bit too generic - something like
# get_package_results_human would be better, but this would break the existing # get_package_results_human would be better, but this would break the existing
# api (unless we keep get_results around as well)... # api (unless we keep get_results around as well)...
format = kwargs.pop('format')
if format is None:
result_line_templ = '%(rep)-20s %(arch)-10s %(status)s' result_line_templ = '%(rep)-20s %(arch)-10s %(status)s'
result_line_mb_templ = '%(rep)-20s %(arch)-10s %(pkg)-30s %(status)s' result_line_mb_templ = '%(rep)-20s %(arch)-10s %(pkg)-30s %(status)s'
else:
result_line_templ = format
result_line_mb_templ = format
r = [] r = []
printed = False printed = False
multibuild_packages = kwargs.pop('multibuild_packages', []) multibuild_packages = kwargs.pop('multibuild_packages', [])