fd/doc/screencast.sh

65 lines
903 B
Bash
Raw Normal View History

2018-01-28 13:32:26 +01:00
#!/bin/bash
# Designed to be executed via svg-term from the fd root directory:
# svg-term --command="bash doc/screencast.sh" --out doc/screencast.svg --padding=10
2022-06-11 19:11:56 +02:00
# Then run this (workaround for #1003):
# sed -i '' 's/<text/<text font-size="1.67"/g' doc/screencast.svg
2018-01-28 13:32:26 +01:00
set -e
set -u
PROMPT="▶"
enter() {
INPUT=$1
DELAY=1
prompt
sleep "$DELAY"
type "$INPUT"
sleep 0.5
printf '%b' "\\n"
eval "$INPUT"
type "\\n"
}
prompt() {
2021-08-14 11:47:04 +02:00
printf '%b ' "$PROMPT" | pv -q
2018-01-28 13:32:26 +01:00
}
type() {
printf '%b' "$1" | pv -qL $((10+(-2 + RANDOM%5)))
}
main() {
IFS='%'
enter "fd"
enter "fd app"
2022-06-10 16:01:20 +02:00
enter "fd fi"
2018-01-28 13:32:26 +01:00
2022-06-10 16:01:20 +02:00
enter "fd fi --type f"
enter "fd --type d"
2018-01-28 13:32:26 +01:00
enter "fd -e md"
enter "fd -e md --exec wc -l"
enter "fd '^[A-Z]'"
enter "fd --exclude src"
enter "fd --hidden sample"
prompt
sleep 3
echo ""
unset IFS
}
main