shithub: hell

Download patch

ref: 41fec90853f89f2b233f49d0ff9b238f54022036
parent: 727a9f57ddf55c13114acaaa2bc872962cca9528
author: penny <penny@limitedideas.org>
date: Sat Oct 4 14:31:44 EDT 2025

/cat s/cat outputs post details

--- a/help.go
+++ b/help.go
@@ -14,6 +14,7 @@
   /reply <index> content       Reply to status by index.
   /like <index>                Favorite status by index.
   /thread <index>              View thread the indexed status is part of.
+  /cat <index>                 Output a status with details (liker, replies, etc).
   /open <index>                Open indexed status in the system web browser.
   /download <index>            Download attached files/media from status.
   /view <index>                Preview status media in media viewer.
--- a/main.go
+++ b/main.go
@@ -260,6 +260,7 @@
 				}
 				formatter := &StatusFormatter{hc: hc, status: postItem, postContext: hc.ctxref}
 				fmt.Println(hyphenate(fmt.Sprintf("%s> %s %s\n", index, formatter.username(), formatter.statusContent())))
+				fmt.Print(formatter.detailLine())
 				return
 			case "like":
 				_, err := client.Favourite(context.Background(), postItem.ID)
--- a/renderer.go
+++ b/renderer.go
@@ -35,6 +35,29 @@
 	return sb.String()
 }
 
+func (st *StatusFormatter) detailLine() string {
+	var sb strings.Builder
+	var items []string
+	if st.status.FavouritesCount > 0 {
+		items = append(items, fmt.Sprintf("Likes:%v", st.status.FavouritesCount))
+	}
+	if st.status.ReblogsCount > 0 {
+		items = append(items, fmt.Sprintf("Reblogs:%v", st.status.ReblogsCount))	
+	}
+	if st.status.RepliesCount > 0 {
+		items = append(items, fmt.Sprintf("Replies:%v", st.status.RepliesCount))
+	}
+
+	for i := range items {
+		sb.WriteString(items[i])
+		if i != len(items) - 1 {
+			sb.WriteString(" ")
+		}
+	}
+	sb.WriteString("\n")
+	return sb.String()
+}
+
 func (hc *Hellclient) renderStatus(content string, index string) (string, map[string]string) {
 	doc, err := html.Parse(strings.NewReader(content))
 	if err != nil {
--