-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathasciicast.sh
executable file
·57 lines (44 loc) · 986 Bytes
/
asciicast.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -o xtrace
set -o errexit
tmpdir="$(mktemp -d)"
trap "rm -rf '$tmpdir'" EXIT
nixTreePath=$(nix build --json | jq '.[].outputs.out' -r)
storePath=$(nix-build -E '(import <nixpkgs> {}).git')
TMUX="tmux -S "$tmpdir/tmux.sock""
echo "$TMUX attach -r"
$TMUX new-session -d
sleep 5
$TMUX resize-window -x 200 -y 40
sleep 1
$TMUX send-keys "export PATH=$nixTreePath/bin:\$PATH" ENTER
sleep 1
$TMUX send-keys "asciinema rec \"$tmpdir/demo.cast\"" ENTER
sleep 2
$TMUX send-keys "nix-tree $storePath"
sleep 1
$TMUX send-keys Enter
sleep 2
# navigate to curl
for i in Right Down Down Down Down Down Right Down; do
$TMUX send-keys $i
sleep 0.5
done
$TMUX send-keys w
sleep 2
$TMUX send-keys Up
sleep 0.5
$TMUX send-keys Up
sleep 1
$TMUX send-keys Enter
sleep 1
$TMUX send-keys Left
sleep 4
$TMUX send-keys q
sleep 1
$TMUX send-keys 'nix-tree --help' ENTER
sleep 2
$TMUX send-keys 'exit' ENTER
sleep 1
$TMUX kill-session
asciinema upload "$tmpdir/demo.cast"