-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddToken.bash
executable file
·81 lines (69 loc) · 1.86 KB
/
addToken.bash
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
#!/bin/bash
# git, github cli, npm? (npm version minor)
# setup ssh key?
clear
source ./menu.sh
source ./addToJsonList.bash
source ./getChainIdFromName.bash
source ./getChainNameFromId.bash
choices=("default" "extended" "unsupported")
getChoice -q "Select List" -o choices -v "selectedChoice"
case $selectedChoice in
default)
[email protected]:Uniswap/default-token-list.git
folderName=default-token-list
;;
extended)
[email protected]:Uniswap/extended-token-list.git
;;
unsupported)
[email protected]:Uniswap/unsupported-token-list.git
;;
esac
folderName=${repository#*Uniswap/}
folderName=${folderName%.git*}
if [ ! -d node_modules ];
then
echo 'installing dependencies'
npm install
fi
if [ ! -d $repository ];
then
echo 'cloning'
git clone $repository
fi
cd ./$folderName/src/tokens
git reset --hard && git checkout main && git pull
files=($(ls -1 | sed -e 's/\..*$//'))
addAnotherChain="Yes"
allNames=()
names=()
while [ "$addAnotherChain" == "Yes" ]
do
getChoice -q "Select Chain" -o files -v "selectedChain"
chainName=$(getChainIdFromName $selectedChain)
chainId=$(getChainNameFromId $chainName)
getJsonList jsonList names $chainId
cat "./$selectedChain.json" | jq ". += $jsonList" > newfile
mv newfile "./$selectedChain.json"
allNames+=("${names[@]}")
# if [ ${#allNames[@]} -eq 0 ]; then
# echo "No errors, hooray"
# else
# echo "Oops, something went wrong..."
# fi
echo $allNames
choices=("No" "Yes")
getChoice -q "Modify Another Chain?" -o choices -v "addAnotherChain"
done
random=$((1 + $RANDOM % 100))
branchName=add-$(printf '%s-' "${allNames[@]}")$(date '+%Y-%m-%d')-$random
branchName="${branchName// /_}"
git checkout -b $branchName
git add -u
commitMsg=$(printf 'add %s' "${names[@]}")
git commit -m "$commitMsg"
npm version minor
git push -u -f origin HEAD
gh pr create
git checkout main