1 #!/usr/bin/sbcl --script
3 (setf *compile-print* nil)
5 (asdf:initialize-source-registry
6 `(:source-registry (:tree ,(car (directory "src"))) :INHERIT-CONFIGURATION))
7 (asdf:load-system :candle)
8 (asdf:load-system :opera)
10 (defpackage #:candle-server-cli (:use #:common-lisp))
11 (in-package #:candle-server-cli)
14 '((:name :help :short "h" :long "help" :description "Print this usage.")
15 (:name :port :short "p" :long "port" :takes-argument t :variable-name "PORT"
16 :description "Port on which to listen for commands. Defaults to 25004")))
23 "Starts a candle continuous integration server. Use 'candle' to interact with the server.")))
25 (multiple-value-bind (options remaining-args error) (opera:process-arguments *options* (cdr sb-ext:*posix-argv*))
27 ((opera:option-present :help options) (usage))
29 (format *error-output* "Don't understand ~A. See 'candle-server -h'~%" (car remaining-args))
30 (sb-ext:exit :code 1))
31 ((and (opera:option-present :port options) (not (parse-integer (opera:option-argument :port options) :junk-allowed t)))
32 (format *error-output* "--port requires a number. See 'candle-server -h'~%"))
36 (opera:option-present :port options)
37 (parse-integer (opera:option-argument :port options) :junk-allowed t))
39 (format t "Starting server on port ~A~%" port)
40 (candle:server port nil)))))