mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 11:48:13 +01:00
50 lines
1.2 KiB
Bash
Executable File
50 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -x
|
|
|
|
export ASCIINEMA_CONFIG_HOME=`mktemp -d 2>/dev/null || mktemp -d -t asciinema-config-home`
|
|
TMP_DATA_DIR=`mktemp -d 2>/dev/null || mktemp -d -t asciinema-data-dir`
|
|
trap "echo rm -rf $ASCIINEMA_CONFIG_HOME $TMP_DATA_DIR" EXIT
|
|
|
|
function asciinema() {
|
|
python3 -m asciinema "$@"
|
|
}
|
|
|
|
# test help message
|
|
|
|
asciinema -h
|
|
|
|
# test version command
|
|
|
|
asciinema --version
|
|
|
|
# test auth command
|
|
|
|
asciinema auth
|
|
|
|
# test play command
|
|
|
|
# asciicast v1
|
|
asciinema play -s 5 tests/demo.json
|
|
asciinema play -s 5 -i 0.2 tests/demo.json
|
|
|
|
# asciicast v2
|
|
asciinema play -s 5 tests/demo.cast
|
|
asciinema play -s 5 -i 0.2 tests/demo.cast
|
|
|
|
# test rec command
|
|
|
|
asciinema rec -c who "$TMP_DATA_DIR/1.cast"
|
|
|
|
bash -c "sleep 1; pkill -28 -n -f 'm asciinema'" &
|
|
asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "$TMP_DATA_DIR/2.cast"
|
|
|
|
bash -c "sleep 1; pkill -n -f 'bash -c echo t3st'" &
|
|
asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "$TMP_DATA_DIR/3.cast"
|
|
|
|
bash -c "sleep 1; pkill -9 -n -f 'bash -c echo t3st'" &
|
|
asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "$TMP_DATA_DIR/4.cast"
|
|
|
|
asciinema rec --stdin -c 'bash -c "echo t3st; sleep 1; echo ok"' "$TMP_DATA_DIR/5.cast"
|