MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / runCommand

Function runCommand

commands.go:96–113  ·  view source on GitHub ↗

runCommand handles a line that starts with "/". Returns true if handled, false if the line should fall through to the model as a normal message.

(line string)

Source from the content-addressed store, hash-verified

94// runCommand handles a line that starts with "/". Returns true if handled,
95// false if the line should fall through to the model as a normal message.
96func runCommand(line string) bool {
97 if !strings.HasPrefix(line, "/") {
98 return false
99 }
100 parts := strings.SplitN(strings.TrimPrefix(line, "/"), " ", 2)
101 name := parts[0]
102 args := ""
103 if len(parts) > 1 {
104 args = strings.TrimSpace(parts[1])
105 }
106 c, ok := commands[name]
107 if !ok {
108 fmt.Printf("unknown command: /%s (try /help)\n", name)
109 return true
110 }
111 c.run(args)
112 return true
113}
114
115func cmdHelp(_ string) {
116 names := make([]string, 0, len(commands))

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected