ref: 188111a12863f097b3f5ffeefbac3beec1efc286
parent: 756f71104d54fed924c32472d3f8dbfe8e5ee09c
author: penny <penny@limitedideas.org>
date: Sat Nov 1 10:12:25 EDT 2025
convert /reload
--- a/commands.go
+++ b/commands.go
@@ -330,12 +330,34 @@
return fmt.Sprintln(hyphenate(helpString(cmd.configPath)))
}
+type reloadcmd struct {+ *Hellclient
+}
+
+func (cmd *reloadcmd) flags() cmdflag {+ return free
+}
+
+func (cmd *reloadcmd) name() string {+ return "reload"
+}
+
+func (cmd *reloadcmd) result(data *cmddata) string {+ account, _, err := loadConfig()
+ if err != nil {+ return fmt.Sprintf("Error reloading config: %s\n", err)+ }
+ cmd.preferences = &account.Preferences
+ return fmt.Sprintln("Successfully reloaded preferences")+
+}
+
func (hc *Hellclient) newCmdArray() ([]cmder) { cmdarray := []cmder{ &profilecmd{hc, hc.cmdload}, &dmcmd{hc}, &helpcmd{hc},+ &reloadcmd{hc},}
return cmdarray
-}
-
+}
\ No newline at end of file
--- a/main.go
+++ b/main.go
@@ -144,15 +144,6 @@
}
hc.prompt.UpdatePrompt()
return
- case "reload":
- account, _, err := loadConfig()
- if err != nil {- fmt.Printf("Error reloading config: %s\n", err)- return
- }
- fmt.Println("Successfully reloaded preferences")- hc.preferences = &account.Preferences
- return
case "stats":
hc.stats.slock.Lock()
var sb strings.Builder
@@ -605,15 +596,6 @@
getter := &PinnedStatusGetter{client: hc.client, ID: account.ID} hc.page.loader = &StatusPages{hc: hc, getter: getter}fmt.Print(hc.page.String())
- return
- case "profile":
- profile := cmd{data: cmdctx, cmder: &profilecmd{hc, hc.cmdload}}- err := profile.checkReqs()
- if err != nil {- fmt.Println(err)
- return
- }
- fmt.Printf("%s", profile.String())return
case "account":
account := accByNameOrRef()
--
⑨