asciicast

package
v0.0.0-...-9eb79f6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(asciicast *Asciicast, path string) error

Types

type Asciicast

type Asciicast struct {
	Version  int      `json:"version"`
	Width    int      `json:"width"`
	Height   int      `json:"height"`
	Duration Duration `json:"duration"`
	Command  string   `json:"command"`
	Title    string   `json:"title"`
	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 {
	Delay float64
	Data  []byte
}

func (*Frame) MarshalJSON

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

func (*Frame) UnmarshalJSON

func (f *Frame) UnmarshalJSON(data []byte) error

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