summaryrefslogtreecommitdiff
path: root/example/run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'example/run.sh')
-rwxr-xr-xexample/run.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/example/run.sh b/example/run.sh
new file mode 100755
index 0000000..1ccff3a
--- /dev/null
+++ b/example/run.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -e
+
+usage () {
+ echo "Usage:
+ serve [--jit] Serve the example"
+}
+
+serve () {
+ variant="$1"
+ if [ "$variant" = "--jit" ]; then
+ echo "running jit"
+ go run -tags jit ../. -n 1 -D main.lua
+ else
+ echo "running puc"
+ go run -tags puc ../. -n 1 -D main.lua
+ fi
+}
+
+cmd="$1"
+[ -z "$cmd" ] || [ "$cmd" = "-h" ] || [ "$cmd" = "--help" ] && usage && exit 1
+shift
+"$cmd" "$@"