Documentation
¶
Index ¶
- type StartOption
- type Terminal
- func (t *Terminal) Close() error
- func (t *Terminal) Cmd() *exec.Cmd
- func (t *Terminal) Done() <-chan error
- func (t *Terminal) Enter() error
- func (t *Terminal) OutputLen() int
- func (t *Terminal) OutputSince(from int) []byte
- func (t *Terminal) Pid() int
- func (t *Terminal) ReadOutput(p []byte) (int, error)
- func (t *Terminal) Render() string
- func (t *Terminal) Resize(w, h int) error
- func (t *Terminal) Screen() string
- func (t *Terminal) Send(s string) error
- func (t *Terminal) SendLine(s string) error
- func (t *Terminal) WaitFor(ctx context.Context, substr string) (string, error)
- func (t *Terminal) WaitForAny(ctx context.Context, substrs ...string) (matched string, screen string, err error)
- func (t *Terminal) WriteStdin(p []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StartOption ¶
type StartOption func(*startConfig)
WithEnv returns a StartOption that adds environment variables.
func WithDir ¶
func WithDir(dir string) StartOption
func WithEnv ¶
func WithEnv(env ...string) StartOption
func WithSize ¶
func WithSize(width, height int) StartOption
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
func StartWithOptions ¶
func (*Terminal) Cmd ¶
Cmd returns the underlying exec.Cmd for env/dir configuration before Start. Only useful when building a Terminal manually; Start() already configures it.
func (*Terminal) OutputLen ¶
OutputLen returns the current length of the raw output buffer. Use before sending a prompt to mark the position for OutputSince.
func (*Terminal) OutputSince ¶
OutputSince returns raw PTY output accumulated after byte offset `from`. The returned slice is a copy — safe to hold across calls.
func (*Terminal) ReadOutput ¶
ReadOutput provides raw access to PTY output, bypassing the emulator. Most callers should use Screen() instead.
func (*Terminal) WaitFor ¶
WaitFor polls the screen until it contains the given substring or the context expires. Returns the screen content at time of match.