1 #!/usr/bin/sbcl --script
3 (setf *compile-print* nil)
5 (asdf:initialize-source-registry
6 `(:source-registry (:tree ,(car (directory "."))) :INHERIT-CONFIGURATION))
8 ((*error-output* (make-broadcast-stream)))
9 (asdf:load-system :candle))
10 (asdf:load-system :opera)
12 (defpackage #:candle-server-cli (:use #:common-lisp))
13 (in-package #:candle-server-cli)
16 '((:name :help :short "h" :long "help" :description "Print this usage.")
17 (:name :port :short "p" :long "port" :takes-argument t :variable-name "PORT"
18 :description "Port on which to listen for commands. Defaults to 25004")
19 (:name :port :long "candle-dir" :takes-argument t :variable-name "DIR"
20 :description "Directory for candle related data. Will be created if does not exist. Defaults to /opt/candle/")))
27 "Starts a candle continuous integration server. Use 'candle' to interact with the server.")))
29 (multiple-value-bind (options remaining-args error) (opera:process-arguments *options* (cdr sb-ext:*posix-argv*))
31 ((opera:option-present :help options) (usage))
33 (format *error-output* "Don't understand ~A. See 'candle-server -h'~%" (car remaining-args))
34 (sb-ext:exit :code 1))
35 ((and (opera:option-present :port options) (not (parse-integer (opera:option-argument :port options) :junk-allowed t)))
36 (format *error-output* "--port requires a number. See 'candle-server -h'~%"))
40 (opera:option-present :port options)
41 (parse-integer (opera:option-argument :port options) :junk-allowed t))
43 (setf candle:*candle-dir*
44 (if (opera:option-present :port options)
45 (opera:option-argument :port options)
47 (format t "Starting server on port ~A~%" port)
48 (candle:server port nil)))))