tape

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithClearAfter

func WithClearAfter() typeOption

WithClearAfter clears the terminal after executing a command.

func WithSleepAfter

func WithSleepAfter(seconds int) typeOption

WithSleepAfter adds a sleep delay after executing a command.

Types

type Config

type Config struct {
	Width    int
	Height   int
	FontSize int
}

Config defines the visual settings for a tape recording.

func DefaultTapeConfig

func DefaultTapeConfig() *Config

DefaultTapeConfig returns a TapeConfig with default dimensions and font size.

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

Recorder manages VHS tape recordings and GIF generation.

func NewTapeRecorder

func NewTapeRecorder(
	vhsPath string,
	cliPath string,
	env map[string]string,
) (*Recorder, error)

NewTapeRecorder creates a new Recorder for the given VHS and CLI binaries.

func (*Recorder) Clear

func (e *Recorder) Clear() string

TypeClear generates VHS commands to type and clear the terminal.

func (*Recorder) CreateTape

func (e *Recorder) CreateTape(
	ctx context.Context,
	tape Tape,
	outputDir string,
) error

CreateTape generates a GIF from a Tape and saves it to outputDir.

func (*Recorder) Press

func (e *Recorder) Press(key string, numTimes int) string

Press generates VHS commands to press a key a specified number of times. Will sleep 50 milliseconds between each press.

func (*Recorder) Sleep

func (e *Recorder) Sleep(seconds int) string

Sleep generates VHS commands to sleep for a specified number of seconds.

func (*Recorder) SpamPress

func (e *Recorder) SpamPress(key string, numTimes int) string

SpamPress generates VHS commands to press a key a specified number of times. Will sleep 5 milliseconds between each press.

func (*Recorder) Type

func (e *Recorder) Type(cmd string, options ...typeOption) string

Type generates VHS commands to type and execute a CLI command.

type Tape

type Tape struct {
	Name string
	// contains filtered or unexported fields
}

Tape represents a VHS tape recording with a name, configuration, and commands.

func NewTape

func NewTape(name string, config *Config, commands ...string) Tape

NewTape creates a new Tape with the given name, config, and VHS commands.

Jump to

Keyboard shortcuts

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