ref: 20315e1a47720b90390ee5093e5d77dbc7b9f82c
parent: 7eeca4c25afb01df3f134237014f9583975fc608
author: penny <penny@limitedideas.org>
date: Wed Nov 5 15:32:25 EST 2025
???
--- a/main.go
+++ b/main.go
@@ -46,111 +46,6 @@
}
fmt.Print(result)
return
-
- if !found {- fmt.Printf("Command not found: \"%s\"\n", command)- return
- }
-
- index, content, _ := strings.Cut(arguments, " ")
-
- postItem, postOK := homeMap[index]
-
- //Wether we got a post index or not
- foundindex := false
- //If there's no index selected load the last post we operated on
- if postOK {- foundindex = true
- lastindex = index
- } else {- postItem, postOK = homeMap[lastindex]
- }
-
- //Okay now see if the post we end up with is a reblog
- if postOK {- if postItem.Reblog != nil {- postItem = postItem.Reblog
-
- }
- }
- cmdctx, _ := hc.cmdload.processLine(line)
- hc.PrintObjectProperties(cmdctx.account)
- hc.PrintObjectProperties(cmdctx.status)
- hc.PrintObjectProperties(cmdctx.reblogger)
- fmt.Println(cmdctx.raw_argument)
- fmt.Println(cmdctx.command)
- fmt.Println(cmdctx.content)
- fmt.Println(cmdctx.index)
-
- accByNameOrRef := func() (account *mastodon.Account) {- if lastaccount != nil {- account = lastaccount
- return
- }
- if lastindex != "" {- account = &postItem.Account
- return
- }
- account = hc.resolveAccount(arguments)
- lastindex = ""
- postItem = nil
- lastaccount = account
- return
- }
- formatter := &StatusFormatter{prefs: hc.preferences, status: postItem, postContext: hc.ctxref, localindex: index}- templater := newStatusTemplateRenderer(formatter)
-
- //Commands require status indexes
- switch command {- case "block":
- var account *mastodon.Account
- if foundindex || index == "" {- account = &postItem.Account
- } else {- account = hc.resolveAccount(index)
- if account == nil {- fmt.Printf("Account or index not found.\n")- return
- }
- }
- blockfunc := func() {- _, err := client.AccountBlock(context.Background(), account.ID)
- if err != nil {- fmt.Printf("Error blocking account: %s.\n")- return
- }
- fmt.Printf("Account blocked: %s\n", account.Acct)- }
- hc.dispatchAnon(blockfunc).Wait()
- return
- case "unblock":
- var account *mastodon.Account
- if foundindex || index == "" {- account = &postItem.Account
- } else {- account = hc.resolveAccount(index)
- if account == nil {- fmt.Printf("Account or index not found.\n")- return
- }
- }
- unblockfunc := func() {- _, err := client.AccountBlock(context.Background(), account.ID)
- if err != nil {- fmt.Printf("Error blocking account: %s.\n")- return
- }
- fmt.Printf("Account unblocked: %s\n", account.Acct)- }
- hc.dispatchAnon(unblockfunc).Wait()
- return
- }
-
- //Posts that need an index and an argument
- if content == "" {- fmt.Printf("\"%v\" requires an argument\n", command)- return
- }
}()
}
}
--
⑨