25 lines
522 B
Bash
Executable file
25 lines
522 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
|
printf 'Usage: %s <tape-file> [output-file]\n' "$0" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v vhs >/dev/null 2>&1; then
|
|
printf '%s\n' 'vhs is required to render terminal recordings.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
TAPE_FILE="$1"
|
|
OUTPUT_FILE="${2:-}"
|
|
|
|
cd "$ROOT_DIR"
|
|
vhs validate "$TAPE_FILE"
|
|
|
|
if [ -n "$OUTPUT_FILE" ]; then
|
|
vhs -o "$OUTPUT_FILE" "$TAPE_FILE"
|
|
else
|
|
vhs "$TAPE_FILE"
|
|
fi
|