Skip to content

Commit

Permalink
Merge pull request #476 from Nitrokey/nethsm-table
Browse files Browse the repository at this point in the history
nethsm: Fix table formatting in list-keys
  • Loading branch information
robin-nitrokey committed Nov 29, 2023
2 parents c58aa0a + cfbc6d6 commit 55b0db3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pynitrokey/cli/nethsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def print_table(headers: Sequence[str], data: Iterable[Sequence[Any]]) -> None:
for row in data:
str_row = []
for i in range(len(widths)):
str_row.append(str(row[i]))
widths[i] = max(widths[i], len(row[i]))
str_value = str(row[i])
str_row.append(str_value)
widths[i] = max(widths[i], len(str_value))
str_data.append(str_row)

print_row(headers, widths)
Expand Down Expand Up @@ -497,8 +498,8 @@ def list_keys(ctx: Context, details: bool, filter: Optional[str]) -> None:
data.append(
[
key_id,
key.type,
", ".join([str(m) for m in key.mechanisms]),
key.type.value,
", ".join([m.value for m in key.mechanisms]),
key.operations,
", ".join(key.tags) if key.tags is not None else "",
]
Expand Down

0 comments on commit 55b0db3

Please sign in to comment.