From a730a33901e85402312f0c5e22f970ef7871ca62 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Mon, 12 Aug 2024 12:04:29 +0200 Subject: [PATCH] Print statuses in search output --- toot/output.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/toot/output.py b/toot/output.py index 5ee47d7..8f2715f 100644 --- a/toot/output.py +++ b/toot/output.py @@ -159,8 +159,9 @@ def print_list_accounts(accounts): def print_search_results(results): - accounts = results["accounts"] - hashtags = results["hashtags"] + accounts = results.get("accounts") + hashtags = results.get("hashtags") + statuses = results.get("statuses") if accounts: click.echo("\nAccounts:") @@ -170,7 +171,12 @@ def print_search_results(results): click.echo("\nHashtags:") click.echo(", ".join([format_tag_name(tag) for tag in hashtags])) - if not accounts and not hashtags: + if statuses: + click.echo("\nStatuses:") + for status in statuses: + click.echo(f" * {green(status['id'])} {status['url']}") + + if not accounts and not hashtags and not statuses: click.echo("Nothing found")