Fix typo in watch.sh that broke it. Add arguments to pass to the compiler.

This commit is contained in:
Alberto Torres 2024-08-29 00:47:51 +02:00
parent 376b9c05f9
commit dfec24b304

12
scripts/watch.sh Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/bin/sh
# TODO: port this to nimscript # TODO: port this to nimscript
cd "$(dirname $0)/.." cd "$(dirname $0)/.."
@ -6,9 +6,9 @@ cd "$(dirname $0)/.."
OUT_NAME=game OUT_NAME=game
MAIN_FILE=src/main.nim MAIN_FILE=src/main.nim
MAIN_FILE_NAME=main MAIN_FILE_NAME=main
JSON="$HOME/.cache/nimskull/$MAIN_FILE_NAME_d/$OUT_NAME.json" JSON="$HOME/.cache/nimskull/${MAIN_FILE_NAME}_d/$OUT_NAME.json"
function build(){ function build(){
$NIM c "$MAIN_FILE" && (pkill -9 game; build/game &) $NIM c "$@" "$MAIN_FILE" && (pkill -9 game; build/game &)
} }
function file_list(){ function file_list(){
if [ -e $JSON ]; then if [ -e $JSON ]; then
@ -17,8 +17,8 @@ function file_list(){
find -iname "*.nim" find -iname "*.nim"
find -iname "*.blend" find -iname "*.blend"
} }
for p in $(file_list);do echo $p;done # for p in $(file_list);do echo $p;done
build build "$@"
while inotifywait -e modify $(file_list) ;do while inotifywait -e modify $(file_list) ;do
build build "$@"
done done