+(defun delete-project (args)
+ (let*
+ ((options
+ '((:name :help :short "h" :long "help" :description "Print this usage.")
+ (:positional "<name>" :description "<name> is the name of the project to delete")))
+ (usage (opera:usage "candle project delete" options)))
+ (multiple-value-bind (options remaining-args error) (opera:process-arguments options args)
+ (cond
+ ((eql error :unknown-option) (format *error-output* "Unknown option: ~A. See 'candle project delete --help'.~%" (car remaining-args)))
+ ((eql error :required-argument-missing) (format *error-output* "Missing argument for ~A. See 'candle project delete --help'.~%" (car remaining-args)))
+ ((opera:option-present :help options) (format t "~A" usage))
+ ((not remaining-args) (format *error-output* "Required <name>. See 'candle project delete --help'.~%"))
+ (t
+ (communication:query `(candle:delete-project ,(car remaining-args)))
+ (format t "Removed project ~A~%" (car remaining-args)))))))
+
+(defun show-project (args)
+ (let*
+ ((options
+ '((:name :help :short "h" :long "help" :description "Print this usage.")
+ (:positional "<name>" :description "<name> is the name of the project to show")))
+ (usage (opera:usage "candle project delete" options)))
+ (multiple-value-bind (options remaining-args error) (opera:process-arguments options args)
+ (cond
+ ((eql error :unknown-option) (format *error-output* "Unknown option: ~A. See 'candle project show --help'.~%" (car remaining-args)))
+ ((eql error :required-argument-missing) (format *error-output* "Missing argument for ~A. See 'candle project show --help'.~%" (car remaining-args)))
+ ((opera:option-present :help options) (format t "~A" usage))
+ ((not remaining-args) (format *error-output* "Required <name>. See 'candle project show --help'.~%"))
+ (t
+ (let*
+ ((branch-infos (communication:query `(candle:project-branch-information ,(car remaining-args))))
+ (width (apply #'max (mapcar #'length (mapcar #'car branch-infos)))))
+ (mapcar
+ (lambda (branch-info)
+ (format t (format nil "~~~A@A: ~~A~~%" width)
+ (first branch-info)
+ (job-info->line (second branch-info))))
+ (sort branch-infos #'< :key (lambda (branch-info) (third (second branch-info)))))))))))
+
+(defun refresh-project (args)
+ (let*
+ ((options
+ '((:name :help :short "h" :long "help" :description "Print this usage.")
+ (:positional "<name>" :description "<name> is the name of the project to refresh")))
+ (usage (opera:usage "candle project refresh" options)))
+ (multiple-value-bind (options remaining-args error) (opera:process-arguments options args)
+ (cond
+ ((eql error :unknown-option) (format *error-output* "Unknown option: ~A. See 'candle project refresh --help'.~%" (car remaining-args)))
+ ((eql error :required-argument-missing) (format *error-output* "Missing argument for ~A. See 'candle project refresh --help'.~%" (car remaining-args)))
+ ((opera:option-present :help options) (format t "~A" usage))
+ ((not remaining-args) (format *error-output* "Required <name>. See 'candle project refresh --help'.~%"))
+ (t
+ (communication:query `(candle:refresh-project ,(car remaining-args)))
+ (format t "Refreshed project ~A~%" (car remaining-args)))))))
+
+(defun list-projects ()
+ (format t "~{~{~A ~A~}~%~}" (communication:query `(candle:list-projects))))
+
+;;; Section for ./candle job