1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-11-03 04:17:21 -05:00

Extract print_divider

This commit is contained in:
Ivan Habunek 2023-12-07 10:06:39 +01:00
parent bf5eb9e7f8
commit a4cf678b15
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D

View File

@ -258,11 +258,10 @@ def poll_lines(poll: Poll) -> Generator[str, None, None]:
def print_timeline(items: Iterable[Status]): def print_timeline(items: Iterable[Status]):
width = get_width() print_divider()
click.echo("" * width)
for item in items: for item in items:
print_status(item) print_status(item)
click.echo("" * width) print_divider()
notification_msgs = { notification_msgs = {
@ -274,19 +273,17 @@ notification_msgs = {
def print_notification(notification: Notification): def print_notification(notification: Notification):
width = get_width()
print_notification_header(notification) print_notification_header(notification)
if notification.status: if notification.status:
click.echo("-" * width) print_divider(char="-")
print_status(notification.status) print_status(notification.status)
def print_notifications(notifications: List[Notification]): def print_notifications(notifications: List[Notification]):
width = get_width()
for notification in notifications: for notification in notifications:
click.echo("" * width) print_divider()
print_notification(notification) print_notification(notification)
click.echo("" * width) print_divider()
def print_notification_header(notification: Notification): 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): def format_tag_name(tag):
return green(f"#{tag['name']}") return green(f"#{tag['name']}")