asciinema.org/script/capture.sh

18 lines
367 B
Bash
Raw Normal View History

2012-03-06 22:09:00 +00:00
#!/bin/bash
# Usage:
# ASCIICAST_ID=666 COLS=80 LINES=20 COMMAND="df; df; df; sleep 10"
2012-04-06 18:49:54 +00:00
# DELAY=1 ./tmux-save.sh
2012-03-06 22:09:00 +00:00
2012-04-03 16:54:56 +00:00
set -e
2012-07-25 18:24:20 +00:00
unset TMUX
2012-04-06 18:49:54 +00:00
SESSION_NAME=asciiio-thumb-$ASCIICAST_ID-`date +'%s'`
2012-03-06 22:09:00 +00:00
tmux new -s $SESSION_NAME -d -x $COLS -y $LINES "$COMMAND"
sleep $DELAY
tmux capture-pane -t $SESSION_NAME
2012-04-06 18:49:54 +00:00
tmux save-buffer -
tmux kill-session -t $SESSION_NAME &>/dev/null