blob: a4f7af0e1b7fa1bf6af6c024bd5f8aaab3e5e72a (
plain) (
blame)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#!/bin/sh -ef
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# web/demo_connect.sh: Prepare asciinema(1) demo for connect example
#
# Copyright (c) 2023 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
# Alice Frosi <afrosi@redhat.com>
SEITAN_DIR=$(pwd)
setup_common() {
git pull
make
tmux new-session -d -s $SESSION
tmux send-keys -t $SESSION 'PS1="$ "'
tmux send-keys -t $SESSION C-m
tmux send-keys -t $SESSION clear
tmux send-keys -t $SESSION C-m
tmux set -t $SESSION window-status-format '#W'
tmux set -t $SESSION window-status-current-format '#W'
tmux set -t $SESSION status-left ''
tmux set -t $SESSION window-status-separator ''
tmux set -t $SESSION window-status-style 'bg=colour1 fg=colour15 bold'
tmux set -t $SESSION status-right ''
tmux set -t $SESSION status-style 'bg=colour1 fg=colour15 bold'
tmux set -t $SESSION status-right-style 'bg=colour1 fg=colour15 bold'
tmux send-keys -t $SESSION "cd ${SEITAN_DIR}" ENTER
sleep 1
}
script() {
IFS='
'
for line in $(eval printf '%s\\\n' \$SCRIPT_${1}); do
unset IFS
case ${line} in
"@") tmux send-keys -t $SESSION C-m ;;
"#"*) sleep ${#line} ;;
*) cmd_write "${line}" ;;
esac
IFS='
'
done
unset IFS
}
cmd_write() {
__str="${@}"
while [ -n "${__str}" ]; do
__rem="${__str#?}"
__first="${__str%"$__rem"}"
if [ "${__first}" = ";" ]; then
tmux send-keys -t $SESSION -l '\;'
else
tmux send-keys -t $SESSION -l "${__first}"
fi
sleep 0.05 || :
__str="${__rem}"
done
sleep 2
tmux send-keys -t $SESSION "C-m"
}
wait_seitan_exit() {
while [ "$(pgrep seitan)" != "" ] ; do sleep 1; done
}
clear_panes() {
wait_seitan_exit
panes=$(tmux list-panes |awk '{ print $1 }' | sed 's/://')
for p in $panes
do
tmux select-pane -t $p
tmux send-keys -t $SESSION clear
tmux send-keys -t $SESSION C-m
done
sleep 1
}
get_first_pane() {
pane=$(tmux list-panes | awk 'NR==1{ print $1 }' | sed 's/://')
echo $pane
}
teardown_common() {
sleep 5
tmux kill-session -t $SESSION
sleep 5
}
|