Add terminal log using asciinema
This commit is contained in:
parent
6f6ca6f79d
commit
41935c352c
5 changed files with 23 additions and 0 deletions
18
.bin/asciinema-log
Executable file
18
.bin/asciinema-log
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ -x "$(command -v asciinema)" ] \
|
||||
&& [ -z "$ASCIINEMA_REC" ] \
|
||||
&& [ "$ASCIINEMA_LOG" -gt 0 ]
|
||||
then
|
||||
ASCIINEMA_LOG_DIR="$HOME/.cache/logs"
|
||||
mkdir -p "$ASCIINEMA_LOG_DIR"
|
||||
_file_name_date=$(date +%Y-%m-%d_%H%M%S)
|
||||
export ASCIINEMA_LOG_FILE="$ASCIINEMA_LOG_DIR/asciinema-$_file_name_date.txt"
|
||||
asciinema rec --quiet --raw "$ASCIINEMA_LOG_FILE"
|
||||
|
||||
exit 0 # Parent script should exit
|
||||
fi
|
||||
|
||||
exit 1 # Parent script should not exit
|
Loading…
Add table
Add a link
Reference in a new issue