X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=candle;a=blobdiff_plain;f=src%2Fmain%2Fcli.lisp;h=fe36dfbc1c775d83220fea82694430fa6a1c2804;hp=4b56b16a8016cec79f3f8fe5e1dd5b085c970639;hb=b20fb177f8305dd8739d57c1bd832bd7a98ab25b;hpb=71ec31971d4b7540adfb9edd507fd786e935839d diff --git a/src/main/cli.lisp b/src/main/cli.lisp index 4b56b16..fe36dfb 100644 --- a/src/main/cli.lisp +++ b/src/main/cli.lisp @@ -165,15 +165,8 @@ (case subcommand (:list (job-list (cdr remaining-args))) (:log (job-log (cdr remaining-args))) + (:retry (retry-job (cdr remaining-args))) (t (format t "~A" (job-usage))))))) -; (multiple-value-bind (options remaining-args error) (opera:process-arguments (job-options) 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) "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)))))) (defun job-options () '((:name :help :short "h" :long "help" :description "Print this usage.") @@ -184,8 +177,9 @@ "candle job" (project-options) "Interacts with projects. The available project subcommands are: - list List jobs - log : View the log for a job")) + list List jobs + log : View the log for a job + retry : Retry a job")) (defun job-list (args) (let @@ -218,6 +212,19 @@ (format t "~A" (communication:query `(candle:get-job-log ,project-name ,sha))) (format *error-output* "Job definition ~A is not valid. See 'candle job log --help'.~%" (car remaining-args))))))) +(defun retry-job (args) + (let + ((options + '((:name :help :short "h" :long "help" :description "Print this usage.") + (:positional ":" :description " is the name of the project, while is the sha of the job in question.")))) + (standard-cli "candle job retry" options args :default ":" + (multiple-value-bind (project-name sha) (decompose-job-definition (car remaining-args)) + (if project-name + (progn + (communication:query `(candle:retry-job ,project-name ,sha)) + (format t "Retrying job ~A~%" (car remaining-args))) + (format *error-output* "Job definition ~A is not valid. See 'candle job log --help'.~%" (car remaining-args))))))) + ;;; Section for ./candle run (defmethod execute-command ((command (eql :run)) args)