summaryrefslogtreecommitdiff
path: root/example/run.sh
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-12-27 17:10:01 +0600
committerunwox <me@unwox.com>2024-12-27 17:42:07 +0600
commit7db107d070ff7c853dda50201954e8c40c07b6e9 (patch)
treeed59fcd69cc353d1941f73c3945475e41efc63a8 /example/run.sh
parent3601f923be9012a50a5d53f2a3ae5cfcde58ca7b (diff)
add an example site code
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" "$@"