terminhtml

Create an animated HTML/CSS terminal by running commands and recording their output.

Examples:

# Run two commands
$ terminhtml "echo woo > something.txt" "cat something.txt"

# Output results to a file
$ terminhtml -o output.html "echo woo"

# Run a script my-script.sh
$ terminhtml "$(<my-script.sh)"

# Run setup commands before the animated session
$ terminhtml "cat woo.txt" -s "echo a > woo.txt && echo b >> woo.txt"

# Output partial HTML
$ terminhtml -p "echo woo"

# Allow longer-running commands
$ terminhtml -t 20 "sleep 15 && echo woo"

# Animate commands that prompt for user input
$ terminhtml -m "] " -i "woo" "read -p '[value?] ' varname && echo \$varname"

# Run commands in a specific directory rather than a temporary directory
$ terminhtml -c .. "ls -l"

# Echo the commands to stdout
$ terminhtml -e "echo foo"

# Turn off forcing color output, use the terminal's color setting
$ terminhtml -n "man grep | grep grep"

Usage:

$ terminhtml [OPTIONS] COMMANDS...

Arguments:

  • COMMANDS...: Commands to run [required]

Options:

  • -s, --setup TEXT: Setup commands that are run before the animated session: the IO from these commands are not displayed but can be used to set up the session in a particular state before the animation.

  • -i, --input TEXT: Input to be passed to the commands. Input is to be passed as a list that will be matched up to commands in order. If you need to provide multiple inputs to one command, separate them by \n within the same input item. Note that you must use prompt matchers for input to do anything.

  • -a, --allow-exceptions: Allow exceptions from passed commands, still generate html

  • -m, --prompt-matchers TEXT: Regex patterns to match prompts. When prompts are matched, they will be provided the passed input.

  • -t, --timeout INTEGER: Timeout in seconds for each command. [default: 10]

  • -c, --cwd PATH: Working directory to run commands in. If not passed, defaults to a temporary directory.

  • -o, --out PATH: Output path, defaults to printing to stdout

  • -p, --partial: Whether to output HTML for only the the commands themselves, defaults to full HTML including JS/CSS/full page structure

  • -c, --inline-css: Whether to inline CSS in the HTML, defaults to using a link tag to reference the stylesheet. Note that this option is ignored if –partial is set.

  • -e, --echo: Echo the commands to stdout

  • -n, --no-force-color: Don’t force color output

  • --help: Show this message and exit.