[NEW] record-shell: record shell sessions for librecode

We need to record shell sessions in a standardized way, so I made a
script to accomplish this!
This commit is contained in:
Andrea Rogers 2024-09-30 11:55:01 -05:00
commit 2269df14d6

47
scripts/record-shell Executable file
View file

@ -0,0 +1,47 @@
#!/usr/bin/env bash
: '
* Record sessions with Asciinema for the Librecode project!
'
read -d '' usage <<EOUSAGE
Usage: $0 [-h]
OPTIONS
-h Display this help.
EOUSAGE
while getopts 'h' opt; do
case "${opt}" in
h)
excat "$usage"
;;
*)
dedcat "$usage"
;;
esac
done
shift $((OPTIND-1))
. "$(dirname $0)/util/logging.bash"
. /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 "$rec_prefix/$timestamp"