Skip to content

Commit

Permalink
Set a default value for --format only for --csv
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbc authored and dmach committed Jun 18, 2024
1 parent e2f1643 commit 60094ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6054,7 +6054,7 @@ def do_rremove(self, subcmd, opts):
help='generate output in XML (former results_meta)')
@cmdln.option('', '--csv', action='store_true', default=False,
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=None,
help='format string for default or csv output (not supported for xml)')
@cmdln.option('--show-excluded', action='store_true',
help='show repos that are excluded for this package')
Expand Down Expand Up @@ -6123,6 +6123,8 @@ def do_results(self, subcmd, opts, *args):
print(decode_it(xml), end='')
else:
# csv formatting
if opts.format is None:
opts.format='%(repository)s|%(arch)s|%(state)s|%(dirty)s|%(code)s|%(details)s'
results = [r for r, _ in result_xml_to_dicts(xml)]
print('\n'.join(format_results(results, opts.format)))
else:
Expand Down

0 comments on commit 60094ba

Please sign in to comment.