Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsOutputFrame ¶
IsOutputFrame determines that given frame is output type.
Types ¶
type Asciicast ¶
Asciicast represents asciicast v2 file. First line of file is Header JSON-object. It consists meta information: version, environment variables, terminal size, etc. Next lines is JSON-arrays (one per line) with frame delay, frame type and frame data (escaped string).
type Frame ¶
Frame represents asciicast v2 frame. This is JSON-array with fixed size of 3 elements: [0]: frame delay in seconds (float64), [1]: frame type, [2]: frame data (escaped string).
func (*Frame) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type FrameType ¶
type FrameType string
FrameType is a type of frame. Currently it is only input ("i") frames and output ("o") frames.
type Frames ¶
type Frames []Frame
Frames is a list of frame with additional functions.
func (Frames) AdjustSpeed ¶
AdjustSpeed allows to change time delay between. Speed value must be positive. If speed > 1 delay will be increased. If speed < 1 delay will be decreased.
func (Frames) CapRelativeTime ¶
CapRelativeTime sets minimal delay for frames. Frame time must be relative.
func (Frames) ToAbsoluteTime ¶
ToAbsoluteTime converts frame time to absolute values.
func (Frames) ToRelativeTime ¶
ToRelativeTime converts frame time to relative values.
type Header ¶
type Header struct { Env map[string]string `json:"env"` Width uint `json:"width"` Height uint `json:"height"` Timestamp uint64 `json:"timestamp"` // unix time Version uint `json:"version"` IdleTimeLimit float64 `json:"idle_time_limit"` }
Header represents asciinema v2 file header
type TerminalPlayer ¶
TerminalPlayer is a asciicast to terminal player.
func NewTerminalPlayer ¶
func NewTerminalPlayer() (TerminalPlayer, error)
NewTerminalPlayer initializes terminal and creates terminal asciicasts player.
func (*TerminalPlayer) Play ¶
Play plays provided asciicast. On *nix systems it firstly puts terminal to raw mode (will be restored after finish). Playing is actually putting frame data to terminal without escaping. Player can be interrupted by hitting Ctrl-C. Player can be paused and unpaused by hitting space key. If player paused you can switch to next frame by pressing tab key.