lychee/assets/screencast.sh
Matthias 601adcefd3
Add new SVG-based screencast (#693)
This is taken from https://github.com/sharkdp/fd, so all credits
go to the original authors.

The demo was a bit dated. We've since added more features and
changed the output. On top of that, the gif was a bit blurry.

The new version is in SVG and the commands can be scripted, so
we can change them with a PR and render them through CI.

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2022-08-10 17:35:50 +02:00

60 lines
No EOL
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
#
# Adapted from
# https://github.com/marionebl/svg-term-cli
# https://github.com/sharkdp/fd/blob/master/doc/screencast.sh
#
# Designed to be executed via svg-term from the lychee root directory:
# svg-term --command="bash assets/screencast.sh" --out assets/screencast.svg --padding=10
# Then run this (workaround for https://github.com/sharkdp/fd/issues/1003):
# sed -i '' 's/<text/<text font-size="1.67"/g' assets/screencast.svg
set -e
set -u
PROMPT=""
# Always use latest version of lychee for screencast
alias lychee="cargo run --"
enter() {
INPUT=$1
DELAY=1
prompt
sleep "$DELAY"
type "$INPUT"
sleep 0.5
printf '%b' "\\n"
eval "$INPUT"
type "\\n"
}
prompt() {
printf '%b ' "$PROMPT" | pv -q
}
type() {
printf '%b' "$1" | pv -qL $((10+(-2 + RANDOM%5)))
}
main() {
IFS='%'
enter "lychee README.md"
enter "lychee --verbose --format=json fixtures/TEST.html"
enter "lychee --no-progress --format detailed https://example.com"
enter "lychee --dump --include github -- './**/*.md'"
prompt
sleep 3
echo ""
unset IFS
}
main