1 (in-package #:candle-server-cli)
4 '((:name :help :short "h" :long "help" :description "Print this usage.")
5 (:name :port :short "p" :long "port" :takes-argument t :variable-name "PORT"
6 :description "Port on which to listen for commands. Defaults to 25004")
7 (:name :dir :long "candle-dir" :takes-argument t :variable-name "DIR"
8 :description "Directory for candle related data. Will be created if does not exist. Defaults to /opt/candle/")
9 (:name :system :long "system" :takes-argument t :variable-name "SYSTEM"
10 :description "System on which to run jobs. Currently available are local and aws. Defaults to local.")))
17 "Starts a candle continuous integration server. Use 'candle' to interact with the server.")))
20 (multiple-value-bind (options remaining-args error) (opera:process-arguments *options* (cdr sb-ext:*posix-argv*))
22 ((opera:option-present :help options) (usage))
24 (format *error-output* "Don't understand ~A. See 'candle-server -h'~%" (car remaining-args))
25 (sb-ext:exit :code 1))
26 ((and (opera:option-present :port options) (not (parse-integer (opera:option-argument :port options) :junk-allowed t)))
27 (format *error-output* "--port requires a number. See 'candle-server -h'~%"))
31 (opera:option-present :port options)
32 (parse-integer (opera:option-argument :port options) :junk-allowed t))
34 (setf candle:*job-system*
35 (if (opera:option-present :system options)
36 (intern (string-upcase (opera:option-argument :system options)) :keyword)
39 ((*error-output* (make-broadcast-stream)))
40 (case candle:*job-system*
41 (:aws (asdf:load-system :candle-aws))
42 (:local (asdf:load-system :candle-local))))
43 (setf candle:*candle-dir*
44 (if (opera:option-present :dir options)
45 (opera:option-argument :dir options)
47 (format t "Starting server on port ~A~%" port)
48 (candle:server port nil))))))