Crate replay_rs

Source
Expand description

§replay-rs

A Rust library for recording and replaying terminal sessions with timing data, compatible with the classic Unix script and scriptreplay tools but implemented entirely in Rust with cross-platform support.

§Features

  • Record terminal sessions: Capture command output with precise timing data
  • Replay with speed control: Play back sessions at different speeds (like asciinema)
  • ANSI sequence handling: Clean up problematic control sequences while preserving colors
  • Cross-platform: Works on macOS, Linux, and other Unix-like systems
  • Zero external dependencies: Built-in implementation, no need for external tools
  • Multiple formats: Support for both raw binary and cleaned text output

§Quick Start

use replay_rs::{Recorder, Player};
use std::process::Command;

// Record a command
let mut recorder = Recorder::new("session.log", "session.log.timing")?;
let mut cmd = Command::new("echo");
cmd.arg("Hello, World!");
recorder.record_command(cmd, false)?; // false = binary format, true = text format

// Replay the session
let player = Player::new("session.log.timing", "session.log")?;
player.replay(1.0)?; // 1.0 = normal speed, 2.0 = 2x speed, etc.

Structs§

Player
A player for replaying recorded terminal sessions
Recorder
A recorder for capturing terminal sessions with timing data

Functions§

clean_for_display
Clean up problematic ANSI control sequences while preserving colors