Skip to content

Commit

Permalink
Fix left alignment of cycle column when header is bold for pretty for…
Browse files Browse the repository at this point in the history
…mat (#155)
  • Loading branch information
hugovk authored May 29, 2023
2 parents 159c843 + 49d749d commit 5d1e9ab
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/norwegianblue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,13 @@ def _prettytable(
do_color = color != "no" and format_ == "pretty"

for header in headers:
left_align = header in ("cycle", "latest", "link")
display_header = colored(header, attrs=["bold"]) if do_color else header
col_data = [row[header] if header in row else "" for row in data]
x.add_column(colored(header, attrs=["bold"]) if do_color else header, col_data)
if header in ("cycle", "latest", "link"):
x.align[header] = "l"
x.add_column(display_header, col_data)

if left_align:
x.align[display_header] = "l"

title_prefix = ""
if title:
Expand Down

0 comments on commit 5d1e9ab

Please sign in to comment.