forked from StarCoreSE/SCModRepository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModIdFinder.sh
38 lines (31 loc) · 849 Bytes
/
ModIdFinder.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
#!/bin/bash
# Part of the UniversalUpload workflow, by Aristeas.
# Don't touch this unless stuff breaks, everything's automatic.
IFS=','; arrIN=($1); unset IFS;
find . -type f -name "*.sbmi" >> ./allModDatas.txt
MODIDARR=()
while read path; do
while read sbmiLine; do
if [[ $sbmiLine = \<Id\>* ]] ; then
tmp=${sbmiLine#*>}
modId=${tmp%<*}
modPathTmp=${path%/*}
modPath=${modPathTmp// /\`}
for editedFile in "${arrIN[@]}"
do
if [[ "./$editedFile" == "$modPathTmp"* ]] ; then
MODIDARR+=(\{\"value\":$modId,\"path\":\"$modPath\"\})
break
fi
done
fi
done < "$path"
done < allModDatas.txt
delim=""
joined=""
for item in "${MODIDARR[@]}"; do
joined="${joined}${delim}${item//\`/ }"
delim=","
done
echo "matrix={\"include\":[$joined]}]"
echo > allModDatas.txt