Update start.lisp
This commit is contained in:
parent
544a68bd57
commit
69c4976303
36
start.lisp
36
start.lisp
@ -1,4 +1,38 @@
|
|||||||
(ql:quickload '(:myoji-accent))
|
(ql:quickload '(:myoji-accent))
|
||||||
|
|
||||||
(myoji-accent/accent:initialize-connection)
|
(myoji-accent/accent:initialize-connection)
|
||||||
(reblocks/server:start)
|
|
||||||
|
(defparameter *interface* "localhost")
|
||||||
|
(defparameter *port* 8080)
|
||||||
|
(defparameter *debug* nil)
|
||||||
|
(defparameter *help* nil)
|
||||||
|
|
||||||
|
(defun parse-arguments (&optional (args (uiop:command-line-arguments)))
|
||||||
|
(mapl (lambda (arg)
|
||||||
|
(macrolet ((require-arg (var)
|
||||||
|
`(assert (second ,var) () "~s requires and argument"
|
||||||
|
(car ,var))))
|
||||||
|
(when (member (car arg) '("-h" "--help") :test 'equal)
|
||||||
|
(setq *help* t))
|
||||||
|
(when (member (car arg) '("-i" "--interface") :test 'equal)
|
||||||
|
(require-arg arg)
|
||||||
|
(setq *interface* (second arg)))
|
||||||
|
(when (member (car arg) '("-p" "--port") :test 'equal)
|
||||||
|
(require-arg arg)
|
||||||
|
(setq *port* (parse-integer (second arg))))
|
||||||
|
(when (member (car arg) '("-d" "--debug") :test 'equal)
|
||||||
|
(setq *debug* t))))
|
||||||
|
args))
|
||||||
|
|
||||||
|
(defun print-help ()
|
||||||
|
(format t "usage: sbcl --load ~a~%" *load-pathname*)
|
||||||
|
(format t " -h|--help print this message, then exit~%")
|
||||||
|
(format t " -d|--debug enable debug output~%")
|
||||||
|
(format t " -p|--port the port to use (takes an argument)~%")
|
||||||
|
(format t " -i|--interface the address to bind to (takes an argument)~%")
|
||||||
|
(uiop:quit))
|
||||||
|
|
||||||
|
(parse-arguments)
|
||||||
|
(if *help*
|
||||||
|
(print-help)
|
||||||
|
(reblocks/server:start :interface *interface* :port *port* :debug *debug*))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user