bash-util/scripts/record-shell
Andrea Rogers bd3ddab28f record-shell: Add spoopy stdin recording with "-i"
🎃🕷🕸 Happy Halloween!! 👻🍬🍫
2024-10-19 15:21:28 -05:00

53 lines
755 B
Bash
Executable file

#!/usr/bin/env bash
: '
* Record sessions with Asciinema for the Librecode project!
'
. "$(dirname $0)/util/logging.bash"
read -d '' usage <<EOUSAGE
Usage: $0 [-h]
OPTIONS
-h Display this help.
EOUSAGE
SPOOPY_STDIN=''
while getopts 'hi' opt; do
case "${opt}" in
h)
excat "$usage"
;;
i)
SPOOPY_STDIN='--stdin'
;;
*)
dedcat "$usage"
;;
esac
done
shift $((OPTIND-1))
. /etc/os-release
timestamp=$(mktimestamp)
case "${ID}" in
arch)
SUB_ID="${BUILD_ID}"
;;
debian)
SUB_ID="${VERSION_CODENAME}"
;;
*)
SUB_ID="unknown"
;;
esac
rec_prefix="$HOME/librecode/sessions/mine/$ID/$SUB_ID"
mkdir -p "$rec_prefix"
asciinema rec $SPOOPY_STDIN "$rec_prefix/$timestamp"