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))
27 (opera:option-present :port options)
28 (not (parse-integer (opera:option-argument :port options) :junk-allowed t)))
29 (format *error-output* "--port requires a number. See 'candle-server -h'~%"))
33 (opera:option-present :port options)
34 (parse-integer (opera:option-argument :port options) :junk-allowed t))
36 (setf candle:*job-system*
37 (if (opera:option-present :system options)
38 (intern (string-upcase (opera:option-argument :system options)) :keyword)
41 ((*error-output* (make-broadcast-stream)))
42 (case candle:*job-system*
43 (:aws (asdf:load-system :candle-aws))
44 (:local (asdf:load-system :candle-local))))
45 (setf candle:*candle-dir*
46 (if (opera:option-present :dir options)
47 (opera:option-argument :dir options)
49 (candle:server port nil))))))