X-Git-Url: https://code.consxy.com/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fcli.lisp;h=697fb42a5e333e9b04e7fe7dff09ecfdede4b60f;hb=refs%2Fheads%2Fproduction;hp=1fff398fd28aabb595e8c495be6e78e5ba71c58d;hpb=4aa3c53883d919803cac77f47ad16ce33047f6ce;p=candle diff --git a/src/main/cli.lisp b/src/main/cli.lisp index 1fff398..697fb42 100644 --- a/src/main/cli.lisp +++ b/src/main/cli.lisp @@ -269,6 +269,21 @@ (defmethod execute-command ((command (eql :run)) args) (let - ((options '((:name :help :short "h" :long "help" :description "Print this usage.")))) - (standard-cli "run" options args :default nil - (when (not (candle:run)) (sb-ext:exit :code 1))))) + ((options + '((:name :help :short "h" :long "help" :description "Print this usage.") + (:name :task :long "task" :variable-name "TASK" :takes-argument t :description "Run TASK") + (:name :env :long "env" :variable-name "ENV" :takes-argument t + :description "Runs candle with *candle-environment* set to ENV as a keyword.")))) + (standard-cli "candle run" options args :default nil + (when (opera:option-present :env parsed-options) + (setf candle:*environment* (intern (string-upcase (opera:option-argument :env parsed-options)) :keyword))) + (cond + ((opera:option-present :task parsed-options) + (let + ((tasks (candle:list-tasks)) + (specified-task (intern (string-upcase (opera:option-argument :task parsed-options)) :keyword))) + (if + (not (find specified-task (candle:list-tasks))) + (error-and-exit "Task ~(~A~) does not exist in .candle file" specified-task) + (candle:run specified-task)))) + (t (when (not (candle:run)) (sb-ext:exit :code 1)))))))