mirror of
https://codeberg.org/bunbun/bunbun.dev
synced 2025-01-22 12:44:29 -08:00
26 lines
756 B
Plaintext
26 lines
756 B
Plaintext
|
(set _G.port 50625)
|
||
|
(set _G.use-http false)
|
||
|
|
||
|
(local usage (: "Usage: %s [-h] [-p] [--use-http]
|
||
|
|
||
|
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)))
|