blob: 193a62b828aca3c383570d396eff75ddbbe0fc0b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/sh
FILES="$(find * -type f -name "*.bruijn" ! -name "All.bruijn" ! -path "*Generic*")"
# TODO: also handle imports for :input intelligence
list_defs() {
grep -Po "^[^:# \t][^ \t]*" "$1" | sed -e "s#\\(.*\\)#{\"name\": \"\\1\", \"source\": \"$1\"}#g"
inputs="$(awk '/^:input/ {print $2}' "$1")"
for i in $inputs; do
list_defs "${i#std/}.bruijn"
done
}
{
for f in $FILES; do
echo "{\"$f\":"
list_defs "$f" | sed 's/\\/\\\\/g' | jq -s .
echo "}"
done
} | jq -s add
|