kopia lustrzana https://github.com/ihabunek/toot
Extract get_continue
rodzic
561bc6d7b5
commit
08df141a8e
|
@ -8,7 +8,7 @@ from toot import api, http
|
||||||
from toot.cli import Context, cli, json_option, pass_context
|
from toot.cli import Context, cli, json_option, pass_context
|
||||||
from toot.cli.validators import validate_positive
|
from toot.cli.validators import validate_positive
|
||||||
from toot.entities import Status, Tag, from_dict, from_response_list, from_responses_batched
|
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
|
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)
|
click.secho("There may be more results. Increase the --limit or use --pager to see the rest.", dim=True)
|
||||||
else:
|
else:
|
||||||
click.echo("No statuses found containing the given tag")
|
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
|
|
||||||
|
|
|
@ -29,6 +29,16 @@ def print_warning(text: str):
|
||||||
click.secho(f"Warning: {text}", fg="yellow", err=True)
|
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):
|
def print_instance(instance: Instance):
|
||||||
width = get_width()
|
width = get_width()
|
||||||
click.echo(instance_to_text(instance, width))
|
click.echo(instance_to_text(instance, width))
|
||||||
|
|
Ładowanie…
Reference in New Issue