Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jprokos26 committed Sep 14, 2023
1 parent e087ed9 commit 45454ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion armory/cli/tools/collect_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,14 @@ def _parse_markdown_table(headers, rows):
stacked vertically separated by a newline."""
if isinstance(headers[0], list):
return "\n\n".join([_parse_markdown_table(h, r) for h, r in zip(headers, rows)])
rows = [[str(r) for r in row] for row in rows]
column_widths = [max(map(len, col)) for col in zip(*rows, headers)]
headers = [f"{h:<{w}}" for h, w in zip(headers, column_widths)]
rows = [[f"{r:<{w}}" for r, w in zip(row, column_widths)] for row in rows]
table = "\n".join(
[
"|".join(headers),
"|".join(["---"] * len(headers)),
"|".join(["-" * w for w in column_widths]),
*["|".join(map(str, row)) for row in rows],
]
)
Expand Down

0 comments on commit 45454ec

Please sign in to comment.