shithub: hell

Download patch

ref: fa6b8e9ed3fe6a4b4cc2efb0bf8552505cb2ffbb
parent: 6da65ab20885651ba1fc696db257649488641d53
author: penny <penny@limitedideas.org>
date: Sat Aug 2 18:29:36 EDT 2025

Bookmarks, image description rendering

--- a/commands.go
+++ b/commands.go
@@ -4,7 +4,7 @@
 	"strings"
 )
 
-var commands = []string{"examine", "reply", "like", "thread", "open", "preview", "dm", "rt", "parent", "children", "rm", "download"}
+var commands = []string{"examine", "reply", "like", "thread", "open", "preview", "dm", "rt", "parent", "children", "rm", "download", "mark", "unmark"}
 
 func processInput(input string) (command string, arguments string) {
 
--- a/main.go
+++ b/main.go
@@ -134,6 +134,20 @@
 			} else {
 				fmt.Printf(formatFavorite(postItem, arguments) + "\n")
 			}
+		case "mark":
+			_, err := client.Bookmark(context.Background(), postItem.ID)
+				if err != nil {
+					printMastodonErr(err)
+				} else {
+				fmt.Printf(formatBookmark(postItem, arguments) + "\n")
+				}
+		case "unmark":
+			_, err := client.Unbookmark(context.Background(), postItem.ID)
+				if err != nil {
+					printMastodonErr(err)
+				} else {
+				fmt.Printf(formatUnookmark(postItem, arguments) + "\n")
+				}
 		case "open":
 			url := fmt.Sprintf("%v/statuses/%v", client.Config.Server, postItem.ID)
 			cmd := exec.Command("open", url, "-a", "Eldritch Café")
@@ -144,9 +158,7 @@
 				fmt.Printf("Image preview failed: %v\n", err)
 			}
 		case "download":
-
 			savePostImages(postItem, "/Users/penny/Downloads/")
-
 		case "reply":
 			if currentUser.ID == postItem.Account.ID {
 				recentpost, err = postReply(content, account, *client, postItem.Visibility, postItem.ID)
--- a/mastodon.go
+++ b/mastodon.go
@@ -141,7 +141,7 @@
 	return post.Account.Acct
 }
 
-// Spaces before prefixes....
+// Spaces before prefixes (no space if you're not passing a prefix)
 func formatReblog(post *mastodon.Status, index string) string {
 	reblogString := fmt.Sprintf(" <%v> Reblogged", post.Account.Username)
 	return formatStatusDetailed(post.Reblog, index, reblogString)
@@ -152,6 +152,16 @@
 	return formatStatusDetailed(post, "", favString)
 }
 
+func formatBookmark(post *mastodon.Status, index string) string {
+	favString := fmt.Sprintf("Bookmarked: %v", index)
+	return formatStatusDetailed(post, "", favString)
+}
+
+func formatUnookmark(post *mastodon.Status, index string) string {
+	favString := fmt.Sprintf("Unbookmarked: %v", index)
+	return formatStatusDetailed(post, "", favString)
+}
+
 func formatStatus(post *mastodon.Status, index string) string {
 	return formatStatusDetailed(post, index, " ")
 }
@@ -193,8 +203,13 @@
 		media = post.MediaAttachments
 	}
 
-	for _, _ = range media {
-		postfix = postfix + "🖼️"
+	for _, item := range media {
+		if item.Description != "" {
+			postfix += fmt.Sprintf("🖼️[%v]\n", item.Description)
+			continue
+		}
+		postfix += "🖼️"
+		
 	}
 	plaintext = hyphenate(fmt.Sprintf("%v %v", poststring, postfix))
 	return
--