| Crates.io | castwright |
| lib.rs | castwright |
| version | 0.0.8 |
| created_at | 2025-01-21 01:54:59.149828+00 |
| updated_at | 2025-02-20 03:22:36.917392+00 |
| description | đĨ Scripted terminal recording. |
| homepage | |
| repository | https://github.com/PRO-2684/castwright |
| max_upload_size | |
| id | 1524495 |
| size | 158,981 |
đĨ Scripted terminal recording.
[!NOTE] The name
castwrightis a portmanteau ofasciicastandplaywright.
Have you recorded the same session over and over again, either to hit the right speed or to avoid mistakes? Ever wanted to automate the process of recording terminal sessions, like shell scripts automate the process of running commands? Well, CastWright is here to help.
If you have cargo-binstall, you can install this tool by running:
cargo binstall castwright
Otherwise, you can install it from source:
cargo install castwright
Pre-built binaries are available at Releases.
$ castwright --help
Usage: castwright [-i <input>] [-o <output>] [-x] [-t] [-v]
đĨ Scripted terminal recording.
Options:
-i, --input the path to the input file (`CastWright` script `.cwrt`), or
stdin if not provided
-o, --output the path to the output file (asciicast `.cast`), or stdout
if not provided; If provided, preview mode will be enabled
-x, --execute execute and capture the output of shell commands
-t, --timestamp include timestamp information in the output
-v, --version show version information and exit
-h, --help display usage information
A CastWright script is a text file, conventionally with the .cwrt extension. It is line-based, with each line representing a single instruction. For example:
$ echo "Hello, World!"
Would output an asciicast recording of the following:
$ echo "Hello, World!"
Hello, World!
For multiline commands, use the > prefix and \ suffix, as you would in an interactive shell. For example:
$ echo "Multi-" \
> "line" \
> "command"
Would output an asciicast recording of the following:
$ echo "Multi-" \
> "line" \
> "command"
Multi- line command
In addition, CastWright provides various instructions for customizing the produced asciicast, like typing speed or title. See REFERENCE.md for a detailed reference, or example CastWright scripts under the tests directory.
CastWright can also be used as a Rust library, providing a simple API for creating an asciicast from a CastWright script. In addition, the library provides an AsciiCast struct for creating asciicasts in a streaming fashion.
You can find a list of known caveats in CAVEATS.md. Most notably, each command is executed in a separate shell session, which may not be ideal for some use cases.
pub API.cargo clippy.