#asciinema #text-file #video #asciicast #scenario #generate #tool

app asciinema-scenario

Create asciinema videos from a text file

3 releases (breaking)

0.3.0 Apr 23, 2022
0.2.0 Sep 28, 2020
0.1.0 Sep 12, 2020

#1 in #asciicast

Download history 15/week @ 2024-07-21 22/week @ 2024-07-28 10/week @ 2024-08-04 15/week @ 2024-08-11 8/week @ 2024-08-18 11/week @ 2024-08-25 13/week @ 2024-09-01 13/week @ 2024-09-08 15/week @ 2024-09-15 27/week @ 2024-09-22 18/week @ 2024-09-29 22/week @ 2024-10-06 28/week @ 2024-10-13 12/week @ 2024-10-20 14/week @ 2024-10-27 18/week @ 2024-11-03

75 downloads per month

MIT/Apache

14KB
244 lines

asciinema-scenario

Build

Create asciinema videos from a text file.

Have you ever re-record your asciinema video over and over again to hit perfect speed and avoid making typos? I did, too many times and this is why I wrote this tool.

Installation

If you have Nix installed, then issue nix-build, and the asciinema-scenario executable will be available in ./result/bin/.

$ nix-build
$ result/bin/asciinema-scenario

Usage

asciinema-scenario

How to write a .scenario file?

  • If first line starts with #! it must be followed by JSON object. The object can include:

    Name Type Default Description
    step float 0.10 A time in seconds of typing speed of a single event.
    width int 77 Maximum number of characters in one line.
    height int 20 Number of lines of the video
  • Empty lines will add timeout of 3 x step.

  • Lines starting with #timeout: 1.5 will create a 1.5 second timeout. When custom timeout is needed select the timeout you need.

  • Lines starting with # will be skipped and can serve as comments.

  • Lines starting with $ will be typed out one character at the time with step timeout in between. Every character after # will be brighter.

  • Lines starting with "(nix-shell) $ " will be typed out with (nix-shell) in green color.

  • Lines starting with "--" will clear the screen. A timeout of 18 * step will be there before the terminal screen clears.

  • Everything else will be displayed immediately.

Tips

  • To immediately display a shell command line example (instead of having it being typed out as the default behaviour), precede $ with a zero-width space

  • To quickly play back the scenario you are working on (or any for that matter), use

    $ asciinema-scenario my.scenario | asciinema play -
    # or
    $ asciinema play <(asciinema-scenario my.scenario)
    

Releases

Detailed release notes are available in this repo at CHANGES.md.

Reporting issues

Found a bug? I'd love to know about it!

Please report all issues on the GitHub issue tracker.

License

Licensed under either of these:

Dependencies

~4–13MB
~142K SLoC