ref: 756f71104d54fed924c32472d3f8dbfe8e5ee09c
parent: fe899e66e690d446fd1d0375c06d451ec9d15ef7
author: penny <penny@limitedideas.org>
date: Sat Nov 1 09:19:25 EDT 2025
port help command
--- a/commands.go
+++ b/commands.go
@@ -314,10 +314,28 @@
return fmt.Sprint(hc.formatAccount(account))
}
+type helpcmd struct {+ *Hellclient
+}
+
+func (cmd *helpcmd) name() string {+ return "help"
+}
+
+func (cmd *helpcmd) flags() cmdflag {+ return free
+}
+
+func (cmd *helpcmd) result(data *cmddata) string {+ return fmt.Sprintln(hyphenate(helpString(cmd.configPath)))
+}
+
func (hc *Hellclient) newCmdArray() ([]cmder) { cmdarray := []cmder{ &profilecmd{hc, hc.cmdload}, &dmcmd{hc},+ &helpcmd{hc},}
return cmdarray
-}
\ No newline at end of file
+}
+
--- a/main.go
+++ b/main.go
@@ -36,7 +36,7 @@
func() {line, err := rl.Readline()
- command, arguments, found := processInput(line, commands)
+ command, arguments, found := processInput(line, []string{})//empty line
if command == "" && arguments == "" && err == nil {@@ -143,9 +143,6 @@
return
}
hc.prompt.UpdatePrompt()
- return
- case "help":
- fmt.Println(hyphenate(helpString(hc.configPath)))
return
case "reload":
account, _, err := loadConfig()
--
⑨