Recording CLI Output

02/24/2021, Wed
Categories: #shell
Tags: #svg

Take a Frame from an Asciicast Recording

Using asciinema is a convenient way to create an accessible recording of your terminal if you want to demo features of a CLI app because the output media permits you to select the text that actually runs in the asciinema player.

On occasions, you might be only interested in taking a screenshot of the recording when focusing one command. With the help of "svg-term-cli", a select frame from asciicast recordings can be exported to a svg file.

It is also helpful to record a series of steps on the CLI at a time as to not disrupt your train of thought when you are going through each CLI command intended for something like an instructional tutorial.

# Record your cast
asciinema rec my-super-amazing.cast

Press the key combo ctrl + d when done.

Install the tool to take a frame of the asciicast to svg

npm install -g svg-term-cli

Now to take a frame of the asciicast

# Specify a short millisecond time value to snapshot a single frame
# and to also avoid seeing the 'exit' command when stopping the asciicast recording
svg-term --in my-super-amazing.cast --out even-more-amazing.svg --at 300

Here is an example output

asciicast frame capture to svg