From 4fea5f3a3c50784afc7e05afbd516a4bf81dae8f Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Fri, 26 Jan 2018 13:07:54 +0100 Subject: [PATCH] Ensure -h output can be read at end of cast --- screencast.sh | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/screencast.sh b/screencast.sh index 3aaf675..4e11f6b 100644 --- a/screencast.sh +++ b/screencast.sh @@ -1,34 +1,50 @@ #!/bin/sh set -e -PROMPT="▶ " +PROMPT="▶" enter() { - IFS='%' - type $PROMPT + prompt type $1 sleep 0.5 printf '%b' " ⏎\n" - sleep 0.1 eval $1 type "\n" - unset IFS +} + +prompt() { + printf $PROMPT + type " " } type() { printf '%b' $1 | pv -qL $[10+(-2 + RANDOM%5)] } -enter "fd" +main() { + IFS='%' -enter "fd -e md" + enter "fd" -enter "fd -e md --exec wc -l" + enter "fd -e md" -enter "fd mod" + enter "fd -e md --exec wc -l" -enter "fd sh" + enter "fd mod" -enter "fd -H sample" + enter "fd sh" -enter "fd -h" \ No newline at end of file + enter "fd -H sample" + + enter "fd -h" + + prompt + + sleep 3 + + unset IFS + + echo "" +} + +main \ No newline at end of file