Documentation
¶
Index ¶
Constants ¶
View Source
const LibraryName = "scriptling.console"
Variables ¶
This section is empty.
Functions ¶
func NewLibrary ¶
NewLibrary creates the scriptling.console library.
func SetBackend ¶
func SetBackend(b ConsoleBackend)
SetBackend registers a custom backend (e.g. TUI). Call before running scripts.
Types ¶
type ConsoleBackend ¶
type ConsoleBackend interface {
Input(prompt string, env *object.Environment) (string, error)
Print(text string, env *object.Environment)
PrintAs(label, text string, env *object.Environment)
StreamStart()
StreamStartAs(label string)
StreamChunk(chunk string)
StreamEnd()
SpinnerStart(text string)
SpinnerStop()
SetProgress(label string, pct float64)
SetLabels(user, assistant, system string)
SetStatus(left, right string)
SetStatusLeft(left string)
SetStatusRight(right string)
RegisterCommand(name, description string, handler func(args string))
RemoveCommand(name string)
OnSubmit(fn func(ctx context.Context, text string))
OnEscape(fn func())
ClearOutput()
Run() error
}
ConsoleBackend is the interface scriptling.console calls through. The CLI registers a TUI-backed implementation via SetBackend().
Click to show internal directories.
Click to hide internal directories.