kopia lustrzana https://github.com/ihabunek/toot
Don't join lines before printing
rodzic
869bab3d38
commit
23b48e15aa
|
@ -16,7 +16,7 @@ from toot.entities import (
|
|||
from_response,
|
||||
from_response_list,
|
||||
)
|
||||
from toot.output import get_continue, get_max_width, get_terminal_height, print_timeline, status_lines
|
||||
from toot.output import get_continue, get_terminal_height, get_width, print_timeline, status_lines
|
||||
from toot.utils import drop_empty_values, str_bool_nullable
|
||||
|
||||
|
||||
|
@ -408,7 +408,7 @@ def _print_single(response: Response, clear: bool, limit: Optional[int]):
|
|||
|
||||
|
||||
def _print_paged(responses: Iterable[Response], clear: bool):
|
||||
width = get_max_width()
|
||||
width = get_width()
|
||||
height = get_terminal_height()
|
||||
separator = "─" * width
|
||||
|
||||
|
@ -417,7 +417,7 @@ def _print_paged(responses: Iterable[Response], clear: bool):
|
|||
for response in responses:
|
||||
statuses = from_dict_list(Status, response.json())
|
||||
for status in statuses:
|
||||
lines = [separator] + list(status_lines(status))
|
||||
lines = [separator] + list(status_lines(status, width))
|
||||
if len(batch_lines) + len(lines) > height - 2 and batch_lines:
|
||||
yield "\n".join(batch_lines) + "\n" + separator
|
||||
batch_lines = []
|
||||
|
|
|
@ -44,12 +44,8 @@ def get_continue():
|
|||
|
||||
|
||||
def print_instance(instance: Instance):
|
||||
width = get_width()
|
||||
click.echo(instance_to_text(instance, width))
|
||||
|
||||
|
||||
def instance_to_text(instance: Instance, width: int) -> str:
|
||||
return "\n".join(instance_lines(instance, width))
|
||||
for line in instance_lines(instance, get_width()):
|
||||
click.echo(line)
|
||||
|
||||
|
||||
def instance_lines(instance: Instance, width: int) -> t.Generator[str, None, None]:
|
||||
|
@ -190,15 +186,11 @@ def print_search_results(results):
|
|||
|
||||
|
||||
def print_status(status: Status) -> None:
|
||||
width = get_width()
|
||||
click.echo(status_to_text(status, width))
|
||||
for line in status_lines(status, get_width()):
|
||||
click.echo(line)
|
||||
|
||||
|
||||
def status_to_text(status: Status, width: int) -> str:
|
||||
return "\n".join(status_lines(status))
|
||||
|
||||
|
||||
def status_lines(status: Status) -> t.Generator[str, None, None]:
|
||||
def status_lines(status: Status, width: int) -> t.Generator[str, None, None]:
|
||||
width = get_width()
|
||||
status_id = status.id
|
||||
in_reply_to_id = status.in_reply_to_id
|
||||
|
|
Ładowanie…
Reference in New Issue