Skip to content

Commit

Permalink
added some shell scripts for processing/building
Browse files Browse the repository at this point in the history
  • Loading branch information
elmuerte committed Feb 9, 2024
1 parent d3c5e94 commit 153a792
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lba1.json
lba2.json

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# LBA Gamequotes


# Development

The `jq` utility is used for a lot of parts in the development process.

## Building

The quotes are stored in separate JSON files for each game, based on the TEXT
resource file entry.

These sperate files can be bundled into a single JSON file with the
`bin/merge.sh` shell script.

```
bin/merge.sh lba1 lba2
```

16 changes: 16 additions & 0 deletions bin/merge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -e

if ! command -v jq &> /dev/null
then
echo "jq not installed"
exit 1
fi

for DIR in $@; do
if [ -d "$DIR" ]; then
echo "Merging $DIR/*.json into $DIR.json ..."
cat $DIR/*.json | jq -s '[ .[] | .[] ]' > "$DIR.json"
fi
done
19 changes: 19 additions & 0 deletions bin/validate-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

if ! command -v jq &> /dev/null
then
echo "jq not installed"
exit 1
fi

RESULT=0
for FILE in $@; do
echo "Validating $FILE"
if ! $(jq 'empty' "$FILE"); then
RESULT=1
fi
done

exit $RESULT

0 comments on commit 153a792

Please sign in to comment.