Skip to content

Commit f619bf0

Browse files
committed
Add break tools
1 parent 702541b commit f619bf0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Diff for: pkg/engine/engine.go

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ func (e *Engine) Start(ctx Context, input string) (ret *Return, _ error) {
245245
return e.runOpenAPI(tool, input)
246246
} else if tool.IsEcho() {
247247
return e.runEcho(tool)
248+
} else if tool.IsBreak() {
249+
return e.runBreak(tool)
248250
}
249251
s, err := e.runCommand(ctx, tool, input, ctx.ToolCategory)
250252
if err != nil {

Diff for: pkg/types/tool.go

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
DaemonPrefix = "#!sys.daemon"
1818
OpenAPIPrefix = "#!sys.openapi"
1919
EchoPrefix = "#!sys.echo"
20+
BreakPrefix = "#!sys.break"
2021
CommandPrefix = "#!"
2122
)
2223

@@ -484,6 +485,10 @@ func (t Tool) IsEcho() bool {
484485
return strings.HasPrefix(t.Instructions, EchoPrefix)
485486
}
486487

488+
func (t Tool) IsBreak() bool {
489+
return strings.HasPrefix(t.Instructions, BreakPrefix)
490+
}
491+
487492
func (t Tool) IsHTTP() bool {
488493
return strings.HasPrefix(t.Instructions, "#!http://") ||
489494
strings.HasPrefix(t.Instructions, "#!https://")

0 commit comments

Comments
 (0)