Documentation
¶
Index ¶
- func IsHeartbeatEvent(event StreamEvent) bool
- func IsPTYOutputEvent(event StreamEvent) bool
- func IsPipeOutputEvent(event StreamEvent) bool
- func IsProcessEndEvent(event StreamEvent) bool
- func IsProcessErrorEvent(event StreamEvent) bool
- func IsProcessLifecycleEvent(event StreamEvent) bool
- func IsProcessStartEvent(event StreamEvent) bool
- func IsTerminalResizeEvent(event StreamEvent) bool
- func ToAscicastV3(events iter.Seq2[Event, error], metadata AscicastV3Metadata) iter.Seq2[AscicastV3Line, error]
- func WriteAscicastV3(events iter.Seq2[Event, error], metadata AscicastV3Metadata, ...) error
- type AscicastV3Event
- type AscicastV3Header
- type AscicastV3Line
- type AscicastV3Metadata
- type Cancellor
- type Event
- type EventType
- type HeartbeatEvent
- type LocalCancellor
- type PTYOutputData
- type PTYProcess
- type PipeOutputData
- type PipeProcess
- type PipeProcessFailedError
- type PipeProcessKilledError
- type ProcessEnd
- type ProcessError
- type ProcessOption
- func WithCancellor(cancellor Cancellor) ProcessOption
- func WithEnv(env []string) ProcessOption
- func WithEnvMap(envMap map[string]string) ProcessOption
- func WithEnvVar(key, value string) ProcessOption
- func WithFlushInterval(interval time.Duration) ProcessOption
- func WithMaxBufferSize(size int) ProcessOption
- func WithPTYSize(size pty.Winsize) ProcessOption
- type ProcessStart
- type ProcessStartError
- type StreamEvent
- type StreamType
- type TermInfo
- type TerminalResizeEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsHeartbeatEvent ¶
func IsHeartbeatEvent(event StreamEvent) bool
func IsPTYOutputEvent ¶
func IsPTYOutputEvent(event StreamEvent) bool
func IsPipeOutputEvent ¶
func IsPipeOutputEvent(event StreamEvent) bool
func IsProcessEndEvent ¶
func IsProcessEndEvent(event StreamEvent) bool
func IsProcessErrorEvent ¶
func IsProcessErrorEvent(event StreamEvent) bool
func IsProcessLifecycleEvent ¶
func IsProcessLifecycleEvent(event StreamEvent) bool
func IsProcessStartEvent ¶
func IsProcessStartEvent(event StreamEvent) bool
func IsTerminalResizeEvent ¶
func IsTerminalResizeEvent(event StreamEvent) bool
func ToAscicastV3 ¶
func ToAscicastV3(events iter.Seq2[Event, error], metadata AscicastV3Metadata) iter.Seq2[AscicastV3Line, error]
ToAscicastV3 transforms a stream of console-stream events into asciicast v3 format
func WriteAscicastV3 ¶
func WriteAscicastV3(events iter.Seq2[Event, error], metadata AscicastV3Metadata, writeFunc func([]byte) error) error
WriteAscicastV3 is a convenience function to write asciicast v3 to any writer
Types ¶
type AscicastV3Event ¶
type AscicastV3Event [3]any
AscicastV3Event represents an event line in asciicast v3 format: [interval, code, data]
func NewExitEvent ¶
func NewExitEvent(interval float64, exitCode int) AscicastV3Event
NewExitEvent creates an asciicast exit event
func NewOutputEvent ¶
func NewOutputEvent(interval float64, data []byte) AscicastV3Event
NewOutputEvent creates an asciicast output event
func NewResizeEvent ¶
func NewResizeEvent(interval float64, cols, rows uint16) AscicastV3Event
NewResizeEvent creates an asciicast resize event
func (AscicastV3Event) MarshalJSON ¶
func (e AscicastV3Event) MarshalJSON() ([]byte, error)
MarshalJSON implements AscicastV3Line interface for events
type AscicastV3Header ¶
type AscicastV3Header struct {
Version int `json:"version"`
AscicastV3Metadata
}
AscicastV3Header represents the first line of an asciicast v3 file
func (AscicastV3Header) MarshalJSON ¶
func (h AscicastV3Header) MarshalJSON() ([]byte, error)
MarshalJSON implements AscicastV3Line interface for headers
type AscicastV3Line ¶
AscicastV3Line represents either a header or event line in asciicast v3 format
type AscicastV3Metadata ¶
type AscicastV3Metadata struct {
Term TermInfo `json:"term"`
Timestamp *time.Time `json:"timestamp,omitempty"`
Command string `json:"command,omitempty"`
Title string `json:"title,omitempty"`
Env map[string]string `json:"env,omitempty"`
Tags []string `json:"tags,omitempty"`
}
AscicastV3Metadata contains the metadata for the asciicast header
type Event ¶
type Event struct {
Timestamp time.Time
Event StreamEvent
}
type HeartbeatEvent ¶
HeartbeatEvent represents a keep-alive signal when no output is generated
func (*HeartbeatEvent) String ¶
func (h *HeartbeatEvent) String() string
func (*HeartbeatEvent) Type ¶
func (h *HeartbeatEvent) Type() EventType
type LocalCancellor ¶
type LocalCancellor struct {
// contains filtered or unexported fields
}
LocalCancellor implements process cancellation for local processes
func NewLocalCancellor ¶
func NewLocalCancellor(terminateTimeout time.Duration) *LocalCancellor
type PTYOutputData ¶
type PTYOutputData struct {
Data []byte
}
PTYOutputData represents terminal output from a PTY process with ANSI sequences preserved
func (*PTYOutputData) String ¶
func (p *PTYOutputData) String() string
func (*PTYOutputData) Type ¶
func (p *PTYOutputData) Type() EventType
type PTYProcess ¶
type PTYProcess struct {
// contains filtered or unexported fields
}
PTYProcess represents a process running in a pseudo-terminal
func NewPTYProcess ¶
func NewPTYProcess(cmd string, args []string, opts ...ProcessOption) *PTYProcess
NewPTYProcess creates a new PTY process with functional options
func (*PTYProcess) ExecuteAndStream ¶
ExecuteAndStream starts a PTY process and returns an iterator over Event objects
type PipeOutputData ¶
type PipeOutputData struct {
Data []byte
Stream StreamType
}
PipeOutputData represents stdout/stderr data from the process
func (*PipeOutputData) String ¶
func (o *PipeOutputData) String() string
func (*PipeOutputData) Type ¶
func (o *PipeOutputData) Type() EventType
type PipeProcess ¶
type PipeProcess struct {
// contains filtered or unexported fields
}
func NewPipeProcess ¶
func NewPipeProcess(cmd string, args []string, opts ...ProcessOption) *PipeProcess
func (*PipeProcess) ExecuteAndStream ¶
ExecuteAndStream starts a process and returns an iterator over Event objects
type PipeProcessFailedError ¶
func (PipeProcessFailedError) Error ¶
func (e PipeProcessFailedError) Error() string
type PipeProcessKilledError ¶
func (PipeProcessKilledError) Error ¶
func (e PipeProcessKilledError) Error() string
type ProcessEnd ¶
ProcessEnd represents the completion of process execution
func (*ProcessEnd) String ¶
func (p *ProcessEnd) String() string
func (*ProcessEnd) Type ¶
func (p *ProcessEnd) Type() EventType
type ProcessError ¶
ProcessError represents an error during process execution
func (*ProcessError) String ¶
func (p *ProcessError) String() string
func (*ProcessError) Type ¶
func (p *ProcessError) Type() EventType
type ProcessOption ¶
type ProcessOption func(*processConfig)
ProcessOption represents a functional option for configuring processes
func WithCancellor ¶
func WithCancellor(cancellor Cancellor) ProcessOption
WithCancellor sets a custom cancellor for the process
func WithEnv ¶
func WithEnv(env []string) ProcessOption
WithEnv sets environment variables as a slice of "KEY=value" strings
func WithEnvMap ¶
func WithEnvMap(envMap map[string]string) ProcessOption
WithEnvMap sets environment variables from a map for convenience
func WithEnvVar ¶
func WithEnvVar(key, value string) ProcessOption
WithEnvVar sets a single environment variable
func WithFlushInterval ¶
func WithFlushInterval(interval time.Duration) ProcessOption
WithFlushInterval sets how often to flush output buffers
func WithMaxBufferSize ¶
func WithMaxBufferSize(size int) ProcessOption
WithMaxBufferSize sets the maximum buffer size before forcing a flush
func WithPTYSize ¶
func WithPTYSize(size pty.Winsize) ProcessOption
WithPTYSize sets a custom terminal size for the PTY process
type ProcessStart ¶
ProcessStart represents the beginning of process execution
func (*ProcessStart) String ¶
func (p *ProcessStart) String() string
func (*ProcessStart) Type ¶
func (p *ProcessStart) Type() EventType
type ProcessStartError ¶
Error types for different process failure scenarios
func (ProcessStartError) Error ¶
func (e ProcessStartError) Error() string
type StreamEvent ¶
StreamEvent represents different types of events that can occur during process execution
type StreamType ¶
type StreamType int
const ( Stdout StreamType = iota Stderr )
func (StreamType) String ¶
func (s StreamType) String() string
type TerminalResizeEvent ¶
type TerminalResizeEvent struct {
Rows uint16
Cols uint16
X uint16 // Width in pixels
Y uint16 // Height in pixels
}
TerminalResizeEvent represents a terminal window size change
func (*TerminalResizeEvent) String ¶
func (t *TerminalResizeEvent) String() string
func (*TerminalResizeEvent) Type ¶
func (t *TerminalResizeEvent) Type() EventType