2019-02-15 02:11:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
######################################################
|
|
|
|
# run *.nimble tasks using "nim" instead of "nimble" #
|
|
|
|
######################################################
|
|
|
|
|
|
|
|
# exit on command error
|
|
|
|
set -e
|
|
|
|
|
|
|
|
[ -z "$1" ] && { echo "usage: $0 task_name"; exit 1; }
|
|
|
|
|
|
|
|
F=""
|
|
|
|
for F in *.nimble; do
|
|
|
|
# get the first one
|
|
|
|
break
|
|
|
|
done
|
|
|
|
[ -z "$F" ] && { echo "No *.nimble file found."; exit 1; }
|
|
|
|
|
|
|
|
# "nim" seems to only run custom NimScript files if they have a "nims" extension
|
|
|
|
NIMS="${F%.nimble}.nims"
|
|
|
|
# delete the temporary symlink on script exit
|
|
|
|
cleanup() {
|
|
|
|
rm -rf "$NIMS"
|
|
|
|
}
|
2019-02-16 21:23:17 +00:00
|
|
|
[ -e "$NIMS" ] || { ln -s "$F" "$NIMS"; trap cleanup EXIT; }
|
2019-02-15 02:11:20 +00:00
|
|
|
|
|
|
|
# can't have an "exec" here or the EXIT pseudo-signal won't be triggered
|
2019-02-16 21:23:17 +00:00
|
|
|
$(dirname $0)/env.sh nim "$@" "$NIMS"
|
2019-02-15 02:11:20 +00:00
|
|
|
|