shithub: hell

Download patch

ref: 1a2d0f19c563ea8511712d749fe5a25898301510
parent: 0ec5e0e941040b93aab9d9d1f01b5b3da944a64b
author: penny <penny@limitedideas.org>
date: Tue Aug 12 13:25:30 EDT 2025

Check if post is already bookmarked

--- a/main.go
+++ b/main.go
@@ -167,7 +167,12 @@
 					fmt.Printf(hc.formatBookmark(postItem, arguments) + "\n")
 				}
 			case "unmark":
-				_, err := client.Unbookmark(context.Background(), postItem.ID)
+				postCopy, err := client.GetStatus(context.Background(), postItem.ID)
+				if postCopy.Bookmarked.(bool) && err == nil {
+					fmt.Printf("Post not bookmarked.\n")
+					return
+				}
+				_, err = client.Unbookmark(context.Background(), postItem.ID)
 				if err != nil {
 					printMastodonErr(err)
 				} else {
--