mirror of
https://codeberg.org/bunbun/bunbun.dev
synced 2025-01-22 04:34:29 -08:00
26 lines
743 B
Fennel
26 lines
743 B
Fennel
(set _G.port 16384)
|
|
(set _G.use-http false)
|
|
|
|
(local usage (: "Usage: %s [options]
|
|
|
|
Options:
|
|
-h, --help Show this help message and exit
|
|
-p, --port Set the port number for the server. Don't change this
|
|
unless you're running the server locally
|
|
--use-http Use http instead of https. Only recommended when running
|
|
the server locally
|
|
|
|
" :format (. arg 0)))
|
|
|
|
(for [i 1 (length arg)]
|
|
(tset arg i (: (. arg i) :gsub "^%-+" ""))
|
|
(if (or (= (. arg i) :h) (= (. arg i) :help))
|
|
(do
|
|
(print usage)
|
|
(os.exit))
|
|
(or (= (. arg i) :p) (= (. arg i) :port))
|
|
(do
|
|
(set _G.port (. arg (+ i 1)))
|
|
(set-forcibly! i (+ i 1)))
|
|
(= (. arg i) :use-http) (set _G.use-http true)))
|