|0.1.0||Jul 20, 2023|
#1245 in Command line utilities
23 downloads per month
A tool to help automate the creation of terminal demos. Automatically generate an asciicast file for use with asciinema.
- Generates asciicast files from the settings and instructions in an input YAML file.
- Fast, run time is dependent upon the run time of the shell commands, with minimal overhead.
- Use bash, python, or a custom shell.
- Customize the output's prompt and secondary prompt, separate from the shell's.
- Use hidden commands for automated setup and cleanup.
- Download a prebuilt binary from releases.
- Use cargo-binstall to get a prebuilt binary with
cargo binstall autocast.
- Build and install with
cargo install autocast.
$ autocast -h Automate terminal demos Usage: autocast [OPTIONS] <IN_FILE> <OUT_FILE> Arguments: <IN_FILE> Input file to create the asciicast file with <OUT_FILE> Output asciicast file Options: --width <WIDTH> Terminal width --height <HEIGHT> Terminal height -t, --title <TITLE> Title of the asciicast --shell <SHELL> Shell to use for running commands [default: bash] [possible values: bash, python] -e, --environment <NAME=VALUE> Environment variables to use in the shell process --environment-capture <ENV_VAR> Environment variables to capture [default: TERM] [aliases: env-cap] -d, --type-speed <TYPE_SPEED> Default time between key presses when writing commands [default: 100ms] [aliases: delay] --prompt <PROMPT> The shell prompt to use in the asciicast output [default: "$ "] --secondary-prompt <SECONDARY_PROMPT> The shell secondary prompt to use in the asciicast output [default: "> "] --timeout <TIMEOUT> Maximum amount of time to let a shell command run before returning with an error [default: 30s] --overwrite Overwrite output file if it already exists -h, --help Print help (see more with '--help') -V, --version Print version
autocast --help to see a more in-depth explanation of the CLI arguments. Also see their corresponding settings in full-example.yaml.
Non-default CLI arguments will override settings specified in the input YAML file.
Input YAML File
- Normal shell command or control code.
- Can be a single line or split across multiple lines.
- Waits until the shell prompt is displayed to ensure the command has completed.
- Optionally hidden from asciicast output.
- Starts an interactive shell command like an editor or TUI app.
- Requires a list of keys that are used to control the started command.
- Keys are input in real time (including any waits) while output is continuously captured.
- After all the keys are fed to the command, it must exit, and the shell returned to the prompt.
- Like the normal shell command, it waits until the shell prompt is displayed before running the next instruction.
- Adds time between the output of the last instruction and the start of the next.
- This time is only added in the asciicast output and does not increase the run time of autocast.
- Adds a marker to the asciicast output.
- Markers are chapters that show in the asciinema web player.
- Adds output events to the asciicast output that will clear the terminal.
Contributions/suggestions are very welcome and appreciated! Feel free to create an issue, discussion, or pull request. Especially in need of default configurations for other shells (zsh, fish, etc.) as I have no experience with shells other than bash.