Shell 36 lines
#!/usr/bin/env bash
# Regenerate assets/demo.gif from assets/demo.tape.
# Requires vhs (https://github.com/charmbracelet/vhs) installed locally.
#
# brew install vhs
# scripts/regen-demo.sh
#
# The script builds the local binary first and puts it on PATH so the
# tape's `eeco` invocations resolve to this checkout.
set -euo pipefail
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"
if ! command -v vhs >/dev/null 2>&1; then
echo "vhs not on PATH. Install with: brew install vhs" >&2
exit 1
fi
make build
# Render the canonical (dark) tape, then derive + render the light variant
# by swapping only the theme and output. Both feed the README's
# prefers-color-scheme <picture> block (dark = OneDark, light = AtomOneLight).
PATH="$ROOT:$PATH" vhs assets/demo.tape
light_tape="$(mktemp)"
sed -e 's/^Set Theme .*/Set Theme "AtomOneLight"/' \
-e 's#^Output .*#Output assets/demo-light.gif#' \
assets/demo.tape > "$light_tape"
PATH="$ROOT:$PATH" vhs "$light_tape"
rm -f "$light_tape"
ls -lh assets/demo-dark.gif assets/demo-light.gif