(defun job-info->line (job-info)
(format nil "~A (~A) ~A"
(subseq (first job-info) 0 8)
- (format nil "~{~A/~A/~A ~A:~A~}"
+ (format nil "~{~2,,,'0@A/~2,,,'0@A/~A ~2,,,'0@A:~2,,,'0@A~}"
(utils:time-as-list (third job-info) :month :date :year :hr :min))
(case (second job-info)
(:succeeded (format nil "~c[1;32mPassed~c[0m" #\Esc #\Esc))
(:add (add-project (cdr remaining-args)))
(:show (show-project (cdr remaining-args)))
(:refresh (refresh-project (cdr remaining-args)))
+ (:list (list-projects))
+ (:failures (project-failures (cdr remaining-args)))
(t (project-usage))))))))
(defun project-usage ()
"candle project"
(project-options)
"Interacts with projects. The available project subcommands are:
- add Add a project
- delete Delete a project
- show Show project branch information
- refresh Tell the candle server to refresh the project information")))
+ list List all projects
+ add <name>:<src> Add a project
+ delete <name> Delete a project
+ show <name> Show project branch information
+ refresh <name> Tell the candle server to refresh the project information")))
(defun project-options ()
'((:name :help :short "h" :long "help" :description "Print this usage.")
(:positional "<subcommand>" :description "Project subcommand, see below.")))
-; (:name :show :long "show" :takes-argument t :description
-; "Show branch information for a project named by NAME."
-; :variable-name "NAME")
-; (:name :refresh :long "refresh" :takes-argument t :description
-; "Refresh project named by NAME."
-; :variable-name "NAME")
-; (:name :delete :long "delete" :takes-argument t :description
-; "Delete a project named by NAME."
-; :variable-name "NAME")
-
(defun add-project (args)
(let*
((options
(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))))
+
+(defun project-failures (args)
+ (let*
+ ((options
+ '((:name :help :short "h" :long "help" :description "Print this usage.")
+ (:name :project :long "project" :variable-name "PROJECT" :takes-argument t :description "Restrict failures to project named by PROJECT")))
+ (usage (opera:usage "candle project failures" 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 failures --help'.~%" (car remaining-args)))
+ ((eql error :required-argument-missing) (format *error-output* "Missing argument for ~A. See 'candle project failures --help'.~%" (car remaining-args)))
+ ((opera:option-present :help options) (format t "~A" usage))
+ (t
+ (format t "~A"
+ (communication:query
+ `(candle:failures ,(when (opera:option-present :project options) (opera:option-argument :project options))))))))))
+
;;; Section for ./candle job
(defmethod execute-command ((command (eql :job)) args)
(cond
((eql error :unknown-option) (format *error-output* "Unknown option: ~A. See 'candle job --help'.~%" (car remaining-args)))
((eql error :required-argument-missing) (format *error-output* "Missing argument for ~A. See 'candle job --help'.~%" (car remaining-args)))
- ((opera:option-present :help options) (format t "~A" (opera:usage "candle job" (job-options))))
+ ((opera:option-present :help options) (format t "~A" (opera:usage "candle job" (job-options) "Lists all jobs in PROJECT if no other action is specified")))
((not (opera:option-present :project-name options)) (format *error-output* "Requires --project argument. See 'candle job --help'.~%" ))
((opera:option-present :log options) (job-log (opera:option-argument :project-name options) (opera:option-argument :log options)))
(t (project-history (opera:option-argument :project-name options))))))