1
0
mirror of https://github.com/ihabunek/toot.git synced 2025-05-18 00:58:30 -04:00

Extract get_continue

This commit is contained in:
Ivan Habunek 2025-01-16 11:49:25 +01:00
parent 561bc6d7b5
commit 08df141a8e
No known key found for this signature in database
GPG Key ID: 01DB3DD0D824504C
2 changed files with 11 additions and 11 deletions

View File

@ -8,7 +8,7 @@ from toot import api, http
from toot.cli import Context, cli, json_option, pass_context
from toot.cli.validators import validate_positive
from toot.entities import Status, Tag, from_dict, from_response_list, from_responses_batched
from toot.output import green, print_tag_list, print_timeline, yellow
from toot.output import get_continue, green, print_tag_list, print_timeline, yellow
from toot.utils import drop_empty_values, str_bool_nullable
@ -235,13 +235,3 @@ def timeline(
click.secho("There may be more results. Increase the --limit or use --pager to see the rest.", dim=True)
else:
click.echo("No statuses found containing the given tag")
def get_continue():
click.secho(f"Press {green('Space')} or {green('Enter')} to continue, {yellow('Esc')} or {yellow('q')} to break.")
while True:
char = click.getchar()
if char == ' ' or char == '\r':
return True
if char == '\x1b' or char == 'q':
return False

View File

@ -29,6 +29,16 @@ def print_warning(text: str):
click.secho(f"Warning: {text}", fg="yellow", err=True)
def get_continue():
click.secho(f"Press {green('Space')} or {green('Enter')} to continue, {yellow('Esc')} or {yellow('q')} to break.")
while True:
char = click.getchar()
if char == ' ' or char == '\r':
return True
if char == '\x1b' or char == 'q':
return False
def print_instance(instance: Instance):
width = get_width()
click.echo(instance_to_text(instance, width))