shithub: hell

Download patch

ref: e52e8c751354754acbd4a61cfbf459466aadacae
parent: c31ba4559ca9f89e9aad8ff689207cd6548c50e4
author: penny <penny@limitedideas.org>
date: Sat Oct 4 08:22:29 EDT 2025

add /pinned for displaying pinned posts

--- a/commands.go
+++ b/commands.go
@@ -4,7 +4,7 @@
 	"strings"
 )
 
-var commands = []string{"examine", "reply", "like", "thread", "open", "prev", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats", "next", "view", "bookmarks", "follow", "unfollow", "likes", "help", "reload", "attach", "detach"}
+var commands = []string{"examine", "reply", "like", "thread", "open", "prev", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats", "next", "view", "bookmarks", "follow", "unfollow", "likes", "help", "reload", "attach", "detach", "pinned"}
 
 func processInput(input string) (command string, arguments string, found bool) {
 
--- a/main.go
+++ b/main.go
@@ -373,6 +373,24 @@
 				hc.page.loader = &StatusPages{hc: hc, getter: getter}
 				fmt.Print(hc.page.String())
 				return
+			case "pinned":
+				var account *mastodon.Account
+				if foundindex || index == "" {
+					account = &postItem.Account
+				} else {
+					account = hc.resolveAccount(index)
+					if account == nil {
+						return
+					}
+				}
+
+				hc.pause(true)
+				hc.page = &Page{}
+				hc.page.itembuffer = new([]PageItem)
+				getter := &PinnedStatusGetter{client: hc.client, ID: account.ID}
+				hc.page.loader = &StatusPages{hc: hc, getter: getter}
+				fmt.Print(hc.page.String())
+				return
 			case "account":
 				var account *mastodon.Account
 				if foundindex || index == "" {
--- a/pages.go
+++ b/pages.go
@@ -71,6 +71,26 @@
 	return statuses, err
 }
 
+// Get implementation for pinned statuses
+type PinnedStatusGetter struct {
+	loaded bool
+	ID     mastodon.ID
+	client *mastodon.Client
+}
+
+// Gets pinned statuses for account up to limit
+// Pinned posts are not paginated this is another oneshot
+func (getter *PinnedStatusGetter) Get(limit int) ([]*mastodon.Status, error) {
+	if getter.loaded {
+		return nil, nil
+	}
+	statuses, err := getter.client.GetAccountPinnedStatuses(context.Background(), getter.ID)
+	if err == nil {
+		getter.loaded = true
+	}
+	return statuses, err
+}
+
 // Get implementation for profile statuses
 type AccountStatusGetter struct {
 	page   *mastodon.Pagination
--