mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Trim line when printing table, simplify code
This commit is contained in:
parent
75423c7671
commit
8c68132ddb
@ -46,11 +46,8 @@ def print_table(headers: List[str], data: List[List[str]]):
|
|||||||
underlines = ["-" * width for width in widths]
|
underlines = ["-" * width for width in widths]
|
||||||
|
|
||||||
def print_row(row: List[str]):
|
def print_row(row: List[str]):
|
||||||
for idx, cell in enumerate(row):
|
parts = (ljust(cell, widths[idx]) for idx, cell in enumerate(row))
|
||||||
width = widths[idx]
|
click.echo(" ".join(parts).strip())
|
||||||
click.echo(ljust(cell, width), nl=False)
|
|
||||||
click.echo(" ", nl=False)
|
|
||||||
click.echo()
|
|
||||||
|
|
||||||
print_row(headers)
|
print_row(headers)
|
||||||
print_row(underlines)
|
print_row(underlines)
|
||||||
|
Loading…
Reference in New Issue
Block a user