Skip to content

Commit

Permalink
Sort CLI output alphabetically
Browse files Browse the repository at this point in the history
Provide consistent output that is not dependent on py dict
implemetation

Signed-off-by: Martin Bašti <[email protected]>
  • Loading branch information
MartinBasti committed Dec 22, 2020
1 parent a80b774 commit 70a69fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions koji_containerbuild/plugins/cli_containerbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def print_result(result, level=0, indent=2):
for item in result:
print_result(item, level+1)
elif isinstance(result, dict):
for key, value in result.items():
for key in sorted(result):
print_value(key, level, indent, ':')
print_result(value, level+1)
print_result(result[key], level+1)
else:
print_value(result, level, indent)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli_containerbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def _expected_output(result, offset, indent):
for line in _expected_output(item, offset+indent, indent):
yield line
elif isinstance(result, dict):
for key, value in result.items():
for key in sorted(result):
yield '{}{}:\n'.format(offset, key)
for line in _expected_output(value, offset+indent, indent):
for line in _expected_output(result[key], offset+indent, indent):
yield line
else:
yield '{}{}\n'.format(offset, result)
Expand Down

0 comments on commit 70a69fe

Please sign in to comment.