jj/demos/demo_helpers.sh
Martin von Zweigbergk 986fced69e demos: replace asciinema by screenshots
The demos don't need to be animated - the user wouldn't miss anything
if they skipped to the end. So let's just show the full output so the
user can read through it at their own pace. We could use plain text,
but I think the colors are helpful, so I went with screenshots.

Closes #166.
2022-10-21 06:04:31 -07:00

26 lines
351 B
Bash

#!/bin/bash
set -euo pipefail
new_tmp_dir() {
local dirname
dirname=$(mktemp -d)
mkdir -p "$dirname"
cd "$dirname"
trap "rm -rf '$dirname'" EXIT
}
run_command() {
echo "\$ $@"
eval "$@"
}
blank() {
echo ""
}
comment() {
indented="$(echo "$@"| sed 's/^/# /g')"
blank
echo -e "\033[0;32m${indented}\033[0m"
blank
}