Command to browse bookmarks from the CLI

pull/282/head
Giuseppe Bilotta 2022-12-31 17:36:25 +01:00 zatwierdzone przez Ivan Habunek
rodzic 13fffd9fc1
commit 253eea12a6
2 zmienionych plików z 16 dodań i 3 usunięć

Wyświetl plik

@ -39,8 +39,9 @@ def get_timeline_generator(app, user, args):
return api.home_timeline_generator(app, user, limit=args.count) return api.home_timeline_generator(app, user, limit=args.count)
def timeline(app, user, args): def timeline(app, user, args, generator=None):
generator = get_timeline_generator(app, user, args) if not generator:
generator = get_timeline_generator(app, user, args)
while True: while True:
try: try:
@ -197,6 +198,10 @@ def unbookmark(app, user, args):
print_out("<green>✓ Status unbookmarked</green>") print_out("<green>✓ Status unbookmarked</green>")
def bookmarks(app, user, args):
timeline(app, user, args, api.bookmark_timeline_generator(app, user, limit=args.count))
def reblogged_by(app, user, args): def reblogged_by(app, user, args):
for account in api.reblogged_by(app, user, args.status_id): for account in api.reblogged_by(app, user, args.status_id):
print_out("{}\n @{}".format(account['display_name'], account['acct'])) print_out("{}\n @{}".format(account['display_name'], account['acct']))

Wyświetl plik

@ -191,7 +191,7 @@ common_timeline_args = [
}), }),
] ]
timeline_args = common_timeline_args + [ timeline_and_bookmark_args = [
(["-c", "--count"], { (["-c", "--count"], {
"type": timeline_count, "type": timeline_count,
"help": "number of toots to show per page (1-20, default 10).", "help": "number of toots to show per page (1-20, default 10).",
@ -209,6 +209,8 @@ timeline_args = common_timeline_args + [
}), }),
] ]
timeline_args = common_timeline_args + timeline_and_bookmark_args
AUTH_COMMANDS = [ AUTH_COMMANDS = [
Command( Command(
name="login", name="login",
@ -340,6 +342,12 @@ READ_COMMANDS = [
arguments=timeline_args, arguments=timeline_args,
require_auth=True, require_auth=True,
), ),
Command(
name="bookmarks",
description="Show bookmarked posts",
arguments=timeline_and_bookmark_args,
require_auth=True,
),
] ]
POST_COMMANDS = [ POST_COMMANDS = [