Add toot status command

This commit is contained in:
Ivan Habunek 2023-06-28 12:23:10 +02:00
parent 835f789145
commit 3a375b77ee
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
4 changed files with 19 additions and 2 deletions

View File

@ -3,6 +3,7 @@
changes:
- "**BREAKING:** Require Python 3.7+"
- "Add `timeline --account` option to show the account timeline (thanks Dan Schwarz)"
- "Add `toot status` command to show a single status
- "TUI: Add personal timeline (thanks Dan Schwarz)"
0.36.0:

View File

@ -9,7 +9,7 @@ from toot.auth import login_interactive, login_browser_interactive, create_app_i
from toot.entities import Instance, Notification, Status, from_dict
from toot.exceptions import ApiError, ConsoleError
from toot.output import (print_lists, print_out, print_instance, print_account, print_acct_list,
print_search_results, print_timeline, print_notifications, print_tag_list,
print_search_results, print_status, print_timeline, print_notifications, print_tag_list,
print_list_accounts, print_user_list)
from toot.tui.utils import parse_datetime
from toot.utils import args_get_instance, delete_tmp_status_file, editor_input, multiline_input, EOF_KEY
@ -68,6 +68,12 @@ def timeline(app, user, args, generator=None):
break
def status(app, user, args):
status = api.single_status(app, user, args.status_id)
status = from_dict(Status, status)
print_status(status)
def thread(app, user, args):
toot = api.single_status(app, user, args.status_id)
context = api.context(app, user, args.status_id)

View File

@ -459,6 +459,16 @@ READ_COMMANDS = [
],
require_auth=True,
),
Command(
name="status",
description="Show a single status",
arguments=[
(["status_id"], {
"help": "ID of the status to show.",
}),
],
require_auth=True,
),
Command(
name="timeline",
description="Show recent items in a timeline (home by default)",

View File

@ -271,7 +271,7 @@ def print_search_results(results):
print_out("<yellow>Nothing found</yellow>")
def print_status(status: Status, width: int):
def print_status(status: Status, width: int = 80):
status_id = status.id
in_reply_to_id = status.in_reply_to_id
reblogged_by = status.account if status.reblog else None