Documentation ¶
Index ¶
- Constants
- func EnsureDirectory(path string) error
- func GetFilename(dataDir string, path string) (string, error)
- func WriteAsciinema(filename string, events []Event) error
- type Event
- type EventHandler
- type EventStream
- type FileRecorder
- type MemoryRecorder
- type MultiplexHandler
- type SessionReader
- type SessionWriter
- type Simulator
- func (s *Simulator) Add(events ...interface{}) *Simulator
- func (s *Simulator) AddTime(delta time.Duration, event interface{}) *Simulator
- func (s *Simulator) Defaults() *Simulator
- func (s *Simulator) Events() []Event
- func (s *Simulator) Resize(size geom.Size) *Simulator
- func (s *Simulator) ResizeTime(delta time.Duration, size geom.Size) *Simulator
- func (s *Simulator) Term(i int, v ...interface{}) *Simulator
- func (s *Simulator) TermTime(delta time.Duration, i int, v ...interface{}) *Simulator
- func (s *Simulator) Terminal() emu.Terminal
- func (s *Simulator) Write(data []byte) *Simulator
- func (s *Simulator) WriteBorg(path string) error
- func (s *Simulator) WriteTime(delta time.Duration, data []byte) *Simulator
Constants ¶
const ( // GZIP_BUFFER_SIZE is the number of bytes to write before flushing // to disk. Terminal sessions are surprisingly small, so flushing // every 128k feels safe, but we may need to play with this. GZIP_BUFFER_SIZE = 128 * 1024 )
const (
SESSION_FILE_VERSION = 1
)
Variables ¶
This section is empty.
Functions ¶
func EnsureDirectory ¶ added in v0.1.1
EnsureDirectory creates a directory if it does not exist and checks whether other users can read and write files in it.
func WriteAsciinema ¶ added in v0.1.10
Write `events` to the given file with path `filename` in the Asciicast v2 format. See https://docs.asciinema.org/manual/asciicast/v2/ for more information.
Types ¶
type EventHandler ¶ added in v0.1.13
An EventHandler handles a stream of terminal events.
type EventStream ¶ added in v0.1.13
type EventStream struct {
// contains filtered or unexported fields
}
An EventStream is a proxy for a Stream that turns everything that happens on that Stream into Event structs and passes them to the provided handler.
func NewEventStream ¶ added in v0.1.13
func NewEventStream(stream stream.Stream, handler EventHandler) *EventStream
func (*EventStream) Kill ¶ added in v0.2.0
func (s *EventStream) Kill()
type FileRecorder ¶ added in v0.1.13
type FileRecorder struct {
// contains filtered or unexported fields
}
A FileRecorder writes incoming events to a file.
func NewFileRecorder ¶ added in v0.1.13
func NewFileRecorder(ctx context.Context, filename string) (*FileRecorder, error)
func (*FileRecorder) Process ¶ added in v0.1.13
func (f *FileRecorder) Process(event Event) error
type MemoryRecorder ¶ added in v0.1.13
type MemoryRecorder struct {
// contains filtered or unexported fields
}
A MemoryRecorder stores Events in memory.
func NewMemoryRecorder ¶ added in v0.1.13
func NewMemoryRecorder() *MemoryRecorder
func (*MemoryRecorder) Events ¶ added in v0.1.13
func (r *MemoryRecorder) Events() []Event
func (*MemoryRecorder) Process ¶ added in v0.1.13
func (r *MemoryRecorder) Process(event Event) error
type MultiplexHandler ¶ added in v0.1.13
type MultiplexHandler struct {
// contains filtered or unexported fields
}
A MultiplexHandler chains multiple EventHandlers together in sequence, but returns a single EventHandler.
func NewMultiplexHandler ¶ added in v0.1.13
func NewMultiplexHandler(handlers ...EventHandler) *MultiplexHandler
func (*MultiplexHandler) Process ¶ added in v0.1.13
func (m *MultiplexHandler) Process(event Event) error
type SessionReader ¶ added in v0.1.1
func Open ¶ added in v0.1.1
func Open(filename string) (SessionReader, error)
type SessionWriter ¶ added in v0.1.1
func Create ¶ added in v0.1.1
func Create(filename string) (SessionWriter, error)
type Simulator ¶ added in v0.1.5
type Simulator struct {
// contains filtered or unexported fields
}
Simulator is a convenient way of building recorded sessions programmatically, primarily for testing.
func NewSimulator ¶ added in v0.1.5
func NewSimulator() *Simulator
func (*Simulator) Defaults ¶ added in v0.1.13
Defaults adds events to reset the terminal's size to DEFAULT_SIZE and changes it to LineFeedMode.
func (*Simulator) ResizeTime ¶ added in v0.1.5
func (*Simulator) Term ¶ added in v0.1.5
Term invokes terminfo's Printf method and adds it to the session.
func (*Simulator) Terminal ¶ added in v0.1.13
Terminal processes all of the events in the simulator in a new terminal and returns it.