-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
118 lines (106 loc) · 3.05 KB
/
setup.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh
cp -rf "./branch-gen-base.sh" "./branch-gen.sh"
read -p "Absolute or relative path to your echo directory (examples: C:/Users/user/Documents/SS13\ repos/Echo\ 13/Shiptest, ../../SS13\ repos/Echo\ 13/Shiptest): " new_value
new_value="'$new_value'"
sed -i "8c directory=$new_value" "branch-gen.sh"
while true; do
read -p "Change branch prefix? (default: shiptest-mirror) (Y/N): " answer
case $answer in
[Yy]* )
read -p "New branch prefix: " new_value
sed -i "9s/=.*/=$new_value/" "branch-gen.sh"
break;;
[Nn]* ) break;;
* ) echo "Invalid.";;
esac
done
while true; do
read -p "Change branch suffix? (Y/N): " answer
case $answer in
[Yy]* )
read -p "New branch suffix: " new_value
sed -i "10s/=.*/=$new_value/" "branch-gen.sh"
break;;
[Nn]* ) break;;
* ) echo "Invalid.";;
esac
done
while true; do
read -p "Confirm before running? (Y/N): " answer
case $answer in
[Yy]* )
sed -i "11s/0/1/" "branch-gen.sh"
break;;
[Nn]* )
sed -i "11s/1/0/" "branch-gen.sh"
break;;
* ) echo "Invalid.";;
esac
done
while true; do
read -p "Check current branch status before stashing? (Y/N): " answer
case $answer in
[Yy]* )
sed -i "12s/0/1/" "branch-gen.sh"
break;;
[Nn]* )
sed -i "12s/1/0/" "branch-gen.sh"
break;;
* ) echo "Invalid.";;
esac
done
while true; do
read -p "Open VSC to resolve conflicts? (Y/N): " answer
case $answer in
[Yy]* )
sed -i "13s/0/1/" "branch-gen.sh"
break;;
[Nn]* )
sed -i "13s/1/0/" "branch-gen.sh"
break;;
* ) echo "Invalid.";;
esac
done
while true; do
read -p "Wait on the console and then push changes after you enter anything(required for auto PR)? (Y/N): " answer
case $answer in
[Yy]* )
sed -i "14s/0/1/" "branch-gen.sh"
break;;
[Nn]* )
sed -i "14s/1/0/" "branch-gen.sh"
sed -i "15s/1/0/" "branch-gen.sh"
break;;
* ) echo "Invalid.";;
esac
done
if [[ $answer = "Y" || $answer = "y" ]]
then
while true; do
read -p "Automatically make PRs(requires github CLI)? (Y/N): " answer
case $answer in
[Yy]* )
sed -i "15s/0/1/" "branch-gen.sh"
while true; do
read -p "Login to github cli now? (Y/N): " login
case $login in
[Yy]* )
echo y | gh auth login -w -p https
break;;
[Nn]* )
break;;
* ) echo "Invalid.";;
esac
done
break;;
[Nn]* )
sed -i "15s/1/0/" "branch-gen.sh"
break;;
* ) echo "Invalid.";;
esac
done
fi
echo "Setup done, rerun the branch-gen script if this was your first time running it."
sed -i "4c #./setup.sh/" "branch-gen.sh"
sed -i "5c #exit" "branch-gen.sh"
read