shithub: hell

Download patch

ref: 3bf4db591828464cac77a8555359b38c233c3bce
parent: bf27ab9c4df3796679e4a34cae0fbfaa4b5684f3
author: penny <penny@limitedideas.org>
date: Fri Aug 15 09:10:32 EDT 2025

Replies need an argument

--- a/main.go
+++ b/main.go
@@ -14,13 +14,14 @@
 
 func main() {
 	hc, err := NewHellclient()
-	rl := hc.rl
-	client := hc.client
 	if err != nil {
-		fmt.Printf("Error creating client: %v\n", err)
+		fmt.Printf("Error starting account: %v\n", err)
 		return
 	}
+	rl := hc.rl
+	client := hc.client
 
+
 	//Horrible io pipe hack
 	//Replaces system stdout with the readline one
 	r, w, _ := os.Pipe()
@@ -175,6 +176,7 @@
 				} else {
 					fmt.Printf(hc.formatFavorite(postItem, arguments) + "\n")
 				}
+				return
 			case "mark":
 				_, err := client.Bookmark(context.Background(), postItem.ID)
 				if err != nil {
@@ -182,6 +184,7 @@
 				} else {
 					fmt.Printf(hc.formatBookmark(postItem, arguments) + "\n")
 				}
+				return
 			case "unmark":
 				postCopy, err := client.GetStatus(context.Background(), postItem.ID)
 				if postCopy.Bookmarked.(bool) && err == nil {
@@ -194,10 +197,12 @@
 				} else {
 					fmt.Printf(hc.formatUnbookmark(postItem, arguments) + "\n")
 				}
+				return
 			case "open":
 				url := fmt.Sprintf("%v/statuses/%v", client.Config.Server, postItem.ID)
 				cmd := exec.Command("open", url, "-a", "Eldritch Café")
 				cmd.Run()
+				return
 			case "url":
 				_, indexstr, _ := strings.Cut(arguments, " ")
 				urlindex, err := strconv.Atoi(indexstr)
@@ -210,23 +215,21 @@
 				}
 				cmd := exec.Command("open", hc.urlMap[index][urlindex-1])
 				cmd.Run()
+				return
 			case "preview":
 				err := hc.previewPostImages(postItem, "open -W -a \"Quick Look\"")
 				if err != nil {
 					fmt.Printf("Image preview failed: %v\n", err)
 				}
+				return
 			case "import":
 				err := hc.previewPostImages(postItem, "shortcuts run \"media collector\" --input-path")
 				if err != nil {
 					fmt.Printf("Image preview failed: %v\n", err)
 				}
+				return
 			case "download":
 				savePostImages(postItem, "/Users/penny/Downloads/")
-			case "reply":
-				recentpost, err = postReply(content, *client, postItem.ID, currentUser.ID, postItem)
-				if err != nil {
-					fmt.Println(err)
-				}
 				return
 			case "rt":
 				rtStatus, err := client.Reblog(context.Background(), postItem.ID)
@@ -238,6 +241,7 @@
 				saveWorkRef(homeMap, rtStatus, postref)
 				hc.printPost("?"+postref, rtStatus)
 				postref = IncrementString(postref)
+				return
 			case "parent":
 				if postItem.InReplyToID == nil {
 					fmt.Printf("%v doesn't have a parent\n", index)
@@ -247,6 +251,7 @@
 				saveWorkRef(homeMap, parentStatus, postref)
 				hc.printPost("?"+postref, parentStatus)
 				postref = IncrementString(postref)
+				return
 			case "children":
 				context, err := client.GetStatusContext(context.Background(), postItem.ID)
 				if err != nil {
@@ -261,6 +266,7 @@
 					hc.printPost("?"+postref, context.Descendants[post])
 					postref = IncrementString(postref)
 				}
+				return
 			case "thread":
 				context, err := client.GetStatusContext(context.Background(), postItem.ID)
 				if err != nil {
@@ -281,12 +287,26 @@
 					hc.printPost("?"+postref, context.Descendants[post])
 					postref = IncrementString(postref)
 				}
+				return
 			case "account":
 				account := postItem.Account
 				fmt.Printf(formatAccount(&account))
-
-			default:
-				fmt.Printf("Unimplemented command \"%v\"?\"\n", command)
+				return
+			}
+			
+			//Posts that need an index and an argument
+			if content == "" {
+				fmt.Printf("\"%v\" requires an argument\n", command)
+				return
+			}
+			
+			switch command {
+			case "reply":
+				recentpost, err = postReply(content, *client, postItem.ID, currentUser.ID, postItem)
+				if err != nil {
+					fmt.Println(err)
+				}
+				return
 			}
 		}()
 	}
--