add: tool to validate if declared opposites exist

pull/306/head
Théo BARRAGUÉ 2021-02-22 11:19:01 +01:00
parent c2149bee81
commit ebfcf6a169
Non sono state trovate chiavi note per questa firma nel database
ID Chiave GPG: A5DE7A72475C3A68
1 ha cambiato i file con 17 aggiunte e 0 eliminazioni

17
tools/validate_opposites.sh Executable file
Vedi File

@ -0,0 +1,17 @@
#!/bin/bash
opposites=$(cat relationships/definition.json | grep '"opposite"' | cut -d ':' -f 2 | tr -d ' ' | tr -d '"')
for opposite in $opposites
do
cat relationships/definition.json | grep '"name": "'$opposite'"' >/dev/null 2>&1
res=$?
if [ "$res" -eq 1 ]
then
echo "'$opposite' not found"
exit 1
fi
done
echo "OK, all opposites seem to point to existing relationships"
exit 0