shithub: hell

Download patch

ref: ed65915d10614ad95e1ac809058e81dca32e1578
parent: 3eee011daaef720f28caa8b15cfa5979c7794566
author: penny <penny@limitedideas.org>
date: Thu Oct 16 16:10:57 EDT 2025

/read to mark no mark notifications as read, undocument and untested /translate

--- 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", "pinned", "cat", "play"}
+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", "cat", "play", "translate", "read"}
 
 func processInput(input string) (command string, arguments string, found bool) {
 
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@
 go 1.23.8
 
 require (
-	codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251014133451-9d9caf09d155
+	codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251016232444-1abcf2f063ce
 	github.com/ergochat/readline v0.1.3
 	github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
 	github.com/k3a/html2text v1.2.1
--- a/go.sum
+++ b/go.sum
@@ -2,6 +2,8 @@
 codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251001171436-178f7eef4328/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
 codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251014133451-9d9caf09d155 h1:gMrZQzVc5M6uBEVAWREt483F/A0fRJzPGJfp2Fgltbg=
 codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251014133451-9d9caf09d155/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251016232444-1abcf2f063ce h1:xWTr5fEsoctAq+teYu5UQoIkZ4t3S6/amf4WvxdLKus=
+codeberg.org/penny64/hellclient-go-mastodon v0.0.0-20251016232444-1abcf2f063ce/go.mod h1:uBGYW1AuCWBfm/LaIH4X4SnuWGWcSP4DNH/v/KUUMj8=
 github.com/ergochat/readline v0.1.3 h1:/DytGTmwdUJcLAe3k3VJgowh5vNnsdifYT6uVaf4pSo=
 github.com/ergochat/readline v0.1.3/go.mod h1:o3ux9QLHLm77bq7hDB21UTm6HlV2++IPDMfIfKDuOgY=
 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
--- a/help.go
+++ b/help.go
@@ -48,7 +48,8 @@
 
   /notice                      Prints unread notifications.
                                If there are none unread, opens notification page.
-                             
+                          
+  /read                        Mark notifications as read without displaying them.
   /stats                       Print some running stats.
   /help                        Print this message.
   /bookmarks                   Open bookmarks page.
--- a/main.go
+++ b/main.go
@@ -170,6 +170,16 @@
 				hc.page.loader = &StatusPages{hc: hc, getter: getter}
 				fmt.Print(hc.page.String())
 				return
+			case "read":
+				defer hc.prompt.UpdatePrompt()
+				notifications, err := hc.GetUnreadNotifications()
+				if len(notifications) > 0 {
+					err = hc.SetNotificationsRead(notifications[len(notifications)-1].ID)
+					if err != nil {
+						fmt.Print(err)
+					}
+					return
+				}
 			case "notice":
 				defer hc.prompt.UpdatePrompt()
 				defer hc.pause(true)
@@ -261,6 +271,20 @@
 				line, _ := templater.render("$standard_status\n$detail_line")
 				fmt.Print(line)
 				return
+			case "translate":
+				if !postOK {
+					fmt.Println("translate: no valid status")
+					return
+				}
+				if index == "" {
+					index = lastindex
+				}
+				translated, err := client.TranslateStatus(context.Background(), postItem.ID)
+				if err != nil {
+					fmt.Printf("Translation error: %s\n", err)
+					return
+				}
+				hc.PrintObjectProperties(translated)
 			case "like":
 				_, err := client.Favourite(context.Background(), postItem.ID)
 				if err != nil {
--- a/renderer.go
+++ b/renderer.go
@@ -55,11 +55,7 @@
 }
 
 func (st *StatusFormatter) username() string {
-	var sb strings.Builder
-	sb.WriteString("<")
-	sb.WriteString(st.status.Account.Username)
-	sb.WriteString(">")
-	return sb.String()
+	return fmt.Sprintf("<%s>", st.status.Account.Username)
 }
 
 func (st *StatusFormatter) detailLine() string {
--