Skip to content

Commit

Permalink
Merge branch 'JesseWeinstein-add_bookmark' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
craigmaloney committed Jan 15, 2023
2 parents ddb944e + cf6f555 commit 270a17f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
click>=6.7
Mastodon.py>=1.0.0
Mastodon.py>=1.5.1
colored>=1.3.93
humanize>=0.5.1
emoji>=0.4.5
32 changes: 32 additions & 0 deletions src/tootstream/toot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,30 @@ def unfav(mastodon, rest):
cprint(msg, fg("yellow"))


@command("<id>", "Toots")
def bookmark(mastodon, rest):
"""Bookmark a toot by ID."""
rest = IDS.to_global(rest)
if rest is None:
return
mastodon.status_bookmark(rest)
item = mastodon.status(rest)
msg = " Bookmarked:\n" + get_content(item)
cprint(msg, fg("red"))


@command("<id>", "Toots")
def unbookmark(mastodon, rest):
"""Remove a bookmark from a toot by ID."""
rest = IDS.to_global(rest)
if rest is None:
return
mastodon.status_unbookmark(rest)
item = mastodon.status(rest)
msg = " Removed bookmark: " + get_content(item)
cprint(msg, fg("yellow"))


@command("<id>", "Toots")
def history(mastodon, rest):
"""Shows the history of the conversation for an ID.
Expand Down Expand Up @@ -1834,6 +1858,14 @@ def faves(mastodon, rest):
)


@command("", "Profile")
def bookmarks(mastodon, rest):
"""Displays posts you've bookmarked."""
print_toots(
mastodon, mastodon.bookmarks(), ctx_name="bookmarks", add_completion=False
)


@command("[<N>]", "Profile")
def me(mastodon, rest):
"""Displays toots you've tooted.
Expand Down

0 comments on commit 270a17f

Please sign in to comment.