mirror of
https://github.com/ihabunek/toot
synced 2025-01-28 18:19:23 +01:00
Use click echo instead of print
This commit is contained in:
parent
ad7cfd44d4
commit
7ba2d9cce5
@ -63,7 +63,7 @@ def instance(ctx: Context, instance_url: Optional[str], json: bool):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if json:
|
if json:
|
||||||
print(response.text)
|
click.echo(response.text)
|
||||||
else:
|
else:
|
||||||
instance = from_dict(Instance, response.json())
|
instance = from_dict(Instance, response.json())
|
||||||
print_instance(instance)
|
print_instance(instance)
|
||||||
@ -78,7 +78,7 @@ def search(ctx: Context, query: str, resolve: bool, json: bool):
|
|||||||
"""Search for users or hashtags"""
|
"""Search for users or hashtags"""
|
||||||
response = api.search(ctx.app, ctx.user, query, resolve)
|
response = api.search(ctx.app, ctx.user, query, resolve)
|
||||||
if json:
|
if json:
|
||||||
print(response.text)
|
click.echo(response.text)
|
||||||
else:
|
else:
|
||||||
print_search_results(response.json())
|
print_search_results(response.json())
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ def status(ctx: Context, status_id: str, json: bool):
|
|||||||
"""Show a single status"""
|
"""Show a single status"""
|
||||||
response = api.fetch_status(ctx.app, ctx.user, status_id)
|
response = api.fetch_status(ctx.app, ctx.user, status_id)
|
||||||
if json:
|
if json:
|
||||||
print(response.text)
|
click.echo(response.text)
|
||||||
else:
|
else:
|
||||||
status = from_dict(Status, response.json())
|
status = from_dict(Status, response.json())
|
||||||
print_status(status)
|
print_status(status)
|
||||||
@ -105,7 +105,7 @@ def thread(ctx: Context, status_id: str, json: bool):
|
|||||||
"""Show thread for a toot."""
|
"""Show thread for a toot."""
|
||||||
context_response = api.context(ctx.app, ctx.user, status_id)
|
context_response = api.context(ctx.app, ctx.user, status_id)
|
||||||
if json:
|
if json:
|
||||||
print(context_response.text)
|
click.echo(context_response.text)
|
||||||
else:
|
else:
|
||||||
toot = api.fetch_status(ctx.app, ctx.user, status_id).json()
|
toot = api.fetch_status(ctx.app, ctx.user, status_id).json()
|
||||||
context = context_response.json()
|
context = context_response.json()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user