-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplayground
executable file
·40 lines (33 loc) · 1.08 KB
/
playground
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env janet
(import "./playground" :as play)
(def args (dyn :args))
(def usage
"Script usage."
``` [action]
Actions:
help - Print this usage information
update-janet <ver> - Downloads janet.c/janet.h for version <ver> to janet/ subdirectory
build - Build the janet and playground wasm and js artifacts
install - Move the janet and playground wasm and js artifacts to the public directory
clean - Delete the generated wasm and js artifacts
serve [<host:port>]- Serves current site on <host:port> (default localhost:8000)
version - Print the playground version
```)
(when (< (length args) 2)
(eprint "missing command")
(eprint usage)
(os/exit -1))
(def action (in args 1))
# Do actions
(case action
"help" (print (args 0) usage)
"version" (print play/version)
"clean" (play/clean)
"serve" (play/serve (get args 2))
"update-janet" (play/update-janet (get args 2))
"install" (play/install)
"build" (play/build)
(do
(eprint "Invalid command")
(eprint usage)
(os/exit 1)))