-
Notifications
You must be signed in to change notification settings - Fork 0
/
extsession
executable file
·91 lines (74 loc) · 2.2 KB
/
extsession
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
#!/usr/bin/env bash
set -o pipefail
[[ "${1}" == *t* ]] && SESSION=tachiyomi || SESSION=aniyomi
NAME=$2
ROOT="$HOME/git/${SESSION}-extensions"
DEFAULT_DIR="${ROOT}/src"
TARGET_DIR=$(compgen -G "${DEFAULT_DIR}/*/${NAME}") # Glob expansion moment
if [[ ! -e "$TARGET_DIR" ]]; then
echo "Extension ${NAME} does not exist!"
exit
fi
tmuxCmd(){
tmux send -t "$SESSION" "${@}" C-m
}
openDir() {
tmuxCmd "cd ${1}"
}
neww(){
tmux new-window -t "$SESSION" -n "${@}"
}
splitw(){
tmux split-window -t "$SESSION"
}
getMainKotlinFile() {
# Shows only the classname
className=$(
grep extClass "$TARGET_DIR/build.gradle" \
| grep -Eo "\.[A-Z][A-Za-z0-9]+" \
| cut -d. -f2 \
| sed "s/Generator//"
)
echo "$className.kt"
}
if ! tmux has -t "$SESSION" &> /dev/null; then
tmux new -s "$SESSION" -n Build -d
if [[ "$SESSION" == "tachiyomi" ]]; then
TASK=installDebug
else
TASK=assembleDebug
fi
EXTPATH="build/outputs/apk/debug/*iyomi*.apk"
openDir "$TARGET_DIR"
tmux send -t "$SESSION" "gradle $TASK"
splitw
openDir "$TARGET_DIR"
tmuxCmd "EXTPATH=$EXTPATH"
if [[ $SESSION == "aniyomi" ]]; then
tmux send -t "$SESSION" "anitester \$EXTPATH --proxy socks5://localhost:7173"
fi
neww editor
openDir "$TARGET_DIR/src/eu/kanade/tachiyomi/*xtension/*/*"
tmux send -t "$SESSION" "lvim $(getMainKotlinFile)"
neww search
openDir "$DEFAULT_DIR"
splitw
openDir "$HOME/git/aniyomi"
neww testes
openDir "$HOME/git/teste"
splitw
tmux send -t "$SESSION" "scrcpy -S -b8M -m1024 -t --power-off-on-close --no-audio --print-fps"
neww monitor
#tmuxCmd "su -c 'top -d 10 -s 3 -o PID,USER,RES,CMDLINE'"
openDir "$ROOT"
tmuxCmd mitmproxy
splitw
# tmuxCmd "python ~/pidcat xyz.jmir.tachiyomi.mi.debug"
openDir "$ROOT"
tmux send -t "$SESSION" "rogcat -p $SESSION"
fi
if [[ -z "$TMUX" ]]; then
tmux attach -t "$SESSION"
else
echo "Detach from the current session and attach to $SESSION."
fi