From a4cf678b15e29a9b3a908479d07980de81bdf81d Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Thu, 7 Dec 2023 10:06:39 +0100 Subject: [PATCH] Extract print_divider --- toot/output.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/toot/output.py b/toot/output.py index 9be2231..8ac5390 100644 --- a/toot/output.py +++ b/toot/output.py @@ -258,11 +258,10 @@ def poll_lines(poll: Poll) -> Generator[str, None, None]: def print_timeline(items: Iterable[Status]): - width = get_width() - click.echo("─" * width) + print_divider() for item in items: print_status(item) - click.echo("─" * width) + print_divider() notification_msgs = { @@ -274,19 +273,17 @@ notification_msgs = { def print_notification(notification: Notification): - width = get_width() print_notification_header(notification) if notification.status: - click.echo("-" * width) + print_divider(char="-") print_status(notification.status) def print_notifications(notifications: List[Notification]): - width = get_width() for notification in notifications: - click.echo("─" * width) + print_divider() print_notification(notification) - click.echo("─" * width) + print_divider() def print_notification_header(notification: Notification): @@ -315,6 +312,10 @@ notification_msgs = { } +def print_divider(char: str = "─"): + click.echo(char * get_width()) + + def format_tag_name(tag): return green(f"#{tag['name']}")