rs-rich-record 0.0.4

Record scripted terminal sessions (tapes) into screenshots, asciinema casts, GIF and MP4
Documentation
//! Record scripted terminal sessions: tapes (#599).
//!
//! A tape scripts a session: type, press keys, wait for text on the screen,
//! take screenshots. [`record::record`] runs it in `bash` on a real PTY with a
//! pinned environment, follows the screen with a VT emulator, and returns the
//! screenshots and a timeline. [`record::write_selected`] turns them into the
//! files the tape's `Output` lines ask for ([`record::write`] takes the
//! formats as given):
//!
//! - per screenshot, a PNG in a window frame, an SVG with selectable text
//!   (drawn by rich-ext's frame exporter, [`rich_ext::frame::Frame::to_svg`]),
//!   and a text grid (through [`rich_ext::frame::Frame`]);
//! - an asciinema v2 cast with input events and the theme in its header;
//! - a GIF with a key overlay, and an MP4 when FFmpeg is installed;
//! - a self-contained HTML page with a small player and the screenshots.
//!
//! The window frame, a caption and the key overlay can each be switched on
//! or off ([`record::Presentation`]), and a tape's `Output` chooses what is
//! written.
//!
//! [`record::check`] compares a new run's text grids with committed ones, so
//! documentation media cannot drift from the program it shows.
//!
//! ```no_run
//! use rich_record::{record, tape};
//! let source = std::fs::read_to_string("demo.tape")?;
//! let tape = tape::parse(&source)?;
//! let recording = record::record(&tape, "demo", &record::Options::default())?;
//! let fonts = rich_record::render::raster::Fonts::embedded();
//! // The tape's `Output` formats; `Formats::ALL` puts no further limit on them.
//! let written = record::write_selected(&recording, "media/demo".as_ref(), "demo",
//!                                      record::Formats::ALL, &fonts, &Default::default(), None)?;
//! for skipped in &written.skipped {
//!     eprintln!("skipped {}: {}", skipped.path.display(), skipped.reason);
//! }
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! Linux and macOS are supported. Windows builds through ConPTY but needs
//! `bash` on `PATH` and is experimental.

pub mod record;
pub mod render;
pub mod screen;
pub mod session;
pub mod tape;
pub mod terminal;

pub use record::{Formats, Options, Presentation, Problem, Recording, Skipped, Written};
pub use screen::{Snapshot, Theme};
pub use tape::{Format, Output, Tape, TapeError};