]> git.giacomolli.uk - onechat/blob - stop.go
Reflow the comments of promptTools and terminal
[onechat] / stop.go
1 package main
2
3 import (
4         "strings"
5 )
6
7 // stopCommand is the input line that interrupts the running turn. The line
8 // "/stop NAME" stops the subagent NAME.
9 const stopCommand = "/stop"
10
11 // stopSubagentName returns NAME of a line "/stop NAME", or false for any other
12 // line.
13 func stopSubagentName(line string) (string, bool) {
14         name, found := strings.CutPrefix(strings.TrimSpace(line), stopCommand+" ")
15         name = strings.TrimSpace(name)
16         if !found || name == "" {
17                 return "", false
18         }
19
20         return name, true
21 }