ref: 9b803feba992a8825b7702b167793081385f43df
parent: cceb6dcab404be1046047c4ad92c734e3b045e4c
author: penny <penny@limitedideas.org>
date: Tue Sep 23 23:36:19 EDT 2025
add prev/next commands and a notification implementation
--- a/commands.go
+++ b/commands.go
@@ -4,7 +4,7 @@
"strings"
)
-var commands = []string{"examine", "reply", "like", "thread", "open", "preview", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "vim", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats"}+var commands = []string{"examine", "reply", "like", "thread", "open", "prev", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "vim", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats", "next", "preview"} func processInput(input string) (command string, arguments string, found bool) {--- a/hellclient.go
+++ b/hellclient.go
@@ -46,7 +46,9 @@
urlMap map[string][]string
debugMap map[string]interface{}actionBuffer []func()
-
+
+ //pointer to our current page item
+ page Page
stats *Stats
}
--- a/main.go
+++ b/main.go
@@ -117,9 +117,18 @@
fmt.Printf(sb.String())
hc.stats.slock.Unlock()
return
+ case "prev":
+ hc.page.Prev()
+ fmt.Printf(hc.page.String())
+ return
+ case "next":
+ hc.page.Next()
+ fmt.Printf(hc.page.String())
+ return
case "notice":
noticePage := &NotificationPages{}noticePage.hc = hc
+ hc.page = noticePage
fmt.Printf(noticePage.String())
return
--- a/pages.go
+++ b/pages.go
@@ -19,20 +19,26 @@
}
func (noticeData *NotificationPages) String() string {- notices, err := noticeData.hc.client.GetNotifications(context.Background(), noticeData)
-
- noticeData.Limit = 5
+ if noticeData.page == nil {+ noticeData.page = &mastodon.Pagination{}+ }
+ noticeData.page.Limit = 5
+ notices, err := noticeData.hc.client.GetNotifications(context.Background(), noticeData.page)
if err != nil { fmt.Printf("Error getting notification page: %s\n", err)}
+ fmt.Printf("%+v\n", noticeData.page)+ notices = reverseArray(notices)
return noticeData.hc.RenderNotifications(notices)
}
func (noticeData *NotificationPages) Next() {+ noticeData.page.MinID = ""
}
func (noticeData *NotificationPages) Prev() {+ noticeData.page.MaxID = ""
}
func (noticeData *NotificationPages) Current() int64 {--
⑨