Documentation
¶
Index ¶
- type Player
- func (p *Player) Acquire()
- func (p *Player) Commands() []detect.Command
- func (p *Player) Events() []sessions.Event
- func (p *Player) Goto(index, offset int)
- func (p *Player) GotoProgress(index, offset int, progress chan<- int)
- func (p *Player) Lines() string
- func (p *Player) Location() search.Address
- func (p *Player) Output(start, end int) (data []byte, ok bool)
- func (p *Player) Preview(params *params.Parameters, viewport, location geom.Vec2, ...) *tty.State
- func (p *Player) Process(event sessions.Event) error
- func (p *Player) Release()
- func (p *Player) ReleaseProgress(update func(done, total int))
- func (p *Player) SetHistoryLimit(limit int)
- func (p *Player) SetRetainOutputData(retain bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Player ¶
func FromBorgContext ¶ added in v1.10.0
func FromBorgContext( ctx context.Context, path string, progress chan<- int, ) (p *Player, err error)
FromBorgContext loads a .borg file from disk, processing events as it reads. If `progress` is not nil, it receives percent updates from 0-100 and is closed once loading completes.
func FromEvents ¶
func FromEventsContext ¶ added in v1.2.0
FromEventsContext creates a Player from the given events, but stops if the context is cancelled.
func (*Player) Goto ¶
Goto moves the player to the specified event index and byte offset. If the index and offset are before the current location, the player will reset the terminal and start from the beginning, since there's no way to "rewind" a terminal session. This means that playing backwards is very slow on long sessions.
func (*Player) GotoProgress ¶ added in v0.10.0
GotoProgress is the same as Goto, but it allows for a progress channel to be passed in. The channel will receive progress updates as the player moves through the events.
func (*Player) Lines ¶ added in v1.12.0
Lines returns all Flow lines from the terminal joined into a single string.
func (*Player) Output ¶ added in v0.9.0
Output gets all of the output written in the range [start, end).
func (*Player) Preview ¶
func (p *Player) Preview( params *params.Parameters, viewport, location geom.Vec2, highlights []movement.Highlight, ) *tty.State
Preview captures a preview with the size `viewport` at `location` in the scrollback of the terminal. You may also provide `highlights` that will be passed to the Flow renderer. Returns nil if the player is "in use", which is only used by replay mode to jump back in time.
func (*Player) ReleaseProgress ¶ added in v1.10.0
ReleaseProgress releases the player from replay mode and replays any events that were buffered while it was acquired. If update is non-nil, it will be called with (done,total) as buffered events are processed.
func (*Player) SetHistoryLimit ¶ added in v1.10.0
SetHistoryLimit bounds the amount of terminal scrollback kept in memory. This method is destructive and is intended to be called before any events are processed.
func (*Player) SetRetainOutputData ¶ added in v1.10.0
SetRetainOutputData controls whether output bytes are kept in memory as part of the player's event log. Disabling this prevents seeking and Output() from working, but reduces memory usage when the recording is already persisted to disk.