From 8c68132ddbd55a7f17973fdd1c512c162a210e3f Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Fri, 30 Aug 2024 13:39:41 +0200 Subject: [PATCH] Trim line when printing table, simplify code --- twitchdl/output.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/twitchdl/output.py b/twitchdl/output.py index 92f0d9a..7ec8e43 100644 --- a/twitchdl/output.py +++ b/twitchdl/output.py @@ -46,11 +46,8 @@ def print_table(headers: List[str], data: List[List[str]]): underlines = ["-" * width for width in widths] def print_row(row: List[str]): - for idx, cell in enumerate(row): - width = widths[idx] - click.echo(ljust(cell, width), nl=False) - click.echo(" ", nl=False) - click.echo() + parts = (ljust(cell, widths[idx]) for idx, cell in enumerate(row)) + click.echo(" ".join(parts).strip()) print_row(headers) print_row(underlines)