asciicast

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asciicast

type Asciicast struct {
	Version   int      `json:"version"`
	Width     int      `json:"width"`
	Height    int      `json:"height"`
	Timestamp int64    `json:"timestamp"`
	Duration  Duration `json:"duration,omitempty"`
	Command   string   `json:"command,omitempty"`
	Title     string   `json:"title,omitempty"`
	Env       *Env     `json:"env"`
	Stdout    []Frame  `json:"stdout"`
}

func Load

func Load(url string) (*Asciicast, error)

func NewAsciicast

func NewAsciicast(width, height int, duration float64, command, title string, frames []Frame, env map[string]string) *Asciicast

type AsciicastPlayer

type AsciicastPlayer struct {
	Terminal terminal.Terminal
}

func (*AsciicastPlayer) Play

func (r *AsciicastPlayer) Play(asciicast *Asciicast, maxWait float64) error

type AsciicastRecorder

type AsciicastRecorder struct {
	Terminal terminal.Terminal
}

func (*AsciicastRecorder) Record

func (r *AsciicastRecorder) Record(command, title string, maxWait float64, assumeYes bool, env map[string]string) (Asciicast, error)

type Duration

type Duration float64

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

type Env

type Env struct {
	Term  string `json:"TERM"`
	Shell string `json:"SHELL"`
}

type Frame

type Frame struct {
	Time      float64 // Delay
	EventType string
	EventData []byte //Data
}

func (*Frame) MarshalJSON

func (f *Frame) MarshalJSON() ([]byte, error)

func (*Frame) UnmarshalJSON

func (f *Frame) UnmarshalJSON(data []byte) error
type Header struct {
	Version   int      `json:"version"`
	Width     int      `json:"width"`
	Height    int      `json:"height"`
	Timestamp int64    `json:"timestamp"`
	Duration  Duration `json:"duration,omitempty"`
	Command   string   `json:"command,omitempty"`
	Title     string   `json:"title,omitempty"`
	Env       *Env     `json:"env"`
}

type Player

type Player interface {
	Play(*Asciicast, float64) error
}

func NewPlayer

func NewPlayer() Player

type Recorder

type Recorder interface {
	Record(string, string, float64, bool, map[string]string) (Asciicast, error)
}

func NewRecorder

func NewRecorder() Recorder

type Stream

type Stream struct {
	Frames []Frame
	// contains filtered or unexported fields
}

func NewStream

func NewStream(maxWait float64) *Stream

func (*Stream) Close

func (s *Stream) Close()

func (*Stream) Duration

func (s *Stream) Duration() time.Duration

func (*Stream) Write

func (s *Stream) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL