shithub: hell

Download patch

ref: ae53203b51d8666b4aee0537537450044234c830
parent: 68af9a80aa9208dc4cf9380c9039347c63364142
author: penny <penny@limitedideas.org>
date: Sat Nov 1 03:03:08 EDT 2025

working on account loader

--- a/commands.go
+++ b/commands.go
@@ -108,18 +108,29 @@
 	lastindex   string
 	lastaccount *mastodon.Account
 }
-
+// Cases
+// Return loaded account if tag was foundor was empty but loaded
+// Return loaded account if index was empty
+// If there's no last account, load the account by index and return it
+// If index is empty or . return last account 
 func (data *cmddata) lookupAccount(loader *cmdloader) *mastodon.Account {
+	
 	if data.found_index {
 		return data.account
 	}
-	if loader.lastaccount != nil {
-		return loader.lastaccount
-	}
-	account := loader.hc.resolveAccount(data.index)
-	if account == nil {
+	if data.index == ""  && data.account != nil {
 		return data.account
 	}
+
+	
+	if loader.lastaccount == nil {
+		account := loader.hc.resolveAccount(data.index)
+		if account == nil {
+			return nil
+		}
+	}
+	
+
 	loader.lastaccount = account
 	loader.lastindex = ""
 	return account
@@ -189,6 +200,7 @@
 	index        string
 }
 
+// Cmder interface and post data
 type cmd struct {
 	data  *cmddata
 	cmder cmder
@@ -204,6 +216,7 @@
 	return cmd.cmder.result(cmd.data)
 }
 
+// return an error message if cmddata matches cmders flags
 func (cmd *cmd) checkReqs() (err error) {
 	if(cmd.cmder.flags()&free !=0) {
 		return nil
--