From: Frank Duncan Date: Sun, 12 Dec 2021 17:28:53 +0000 (-0600) Subject: Add project listing X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=commitdiff_plain;h=9407d49f19966b27a3a0d891d65024e547024d76;p=candle Add project listing --- diff --git a/src/main/cli.lisp b/src/main/cli.lisp index c1f013b..8afc840 100644 --- a/src/main/cli.lisp +++ b/src/main/cli.lisp @@ -71,6 +71,7 @@ (:add (add-project (cdr remaining-args))) (:show (show-project (cdr remaining-args))) (:refresh (refresh-project (cdr remaining-args))) + (:list (list-projects)) (t (project-usage)))))))) (defun project-usage () @@ -79,25 +80,16 @@ "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 : Add a project + delete Delete a project + show Show project branch information + refresh Tell the candle server to refresh the project information"))) (defun project-options () '((:name :help :short "h" :long "help" :description "Print this usage.") (:positional "" :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 @@ -178,6 +170,9 @@ (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 (defmethod execute-command ((command (eql :job)) args) @@ -185,7 +180,7 @@ (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)))))) diff --git a/src/main/package.lisp b/src/main/package.lisp index 0f75498..f43a344 100644 --- a/src/main/package.lisp +++ b/src/main/package.lisp @@ -1,6 +1,6 @@ (defpackage #:candle (:use :cl) (:export - #:server #:add-project #:delete-project #:refresh-project + #:server #:add-project #:delete-project #:refresh-project #:list-projects #:project-branch-information #:run #:*candle-dir* #:*job-system* #:project-job-information #:get-job-log)) diff --git a/src/main/server.lisp b/src/main/server.lisp index 1f9a96c..ef80743 100644 --- a/src/main/server.lisp +++ b/src/main/server.lisp @@ -103,3 +103,11 @@ (when (not project) (error "Project does not exist")) (when (not job) (error "Job does not exist")) (job-log job))) + +(defun list-projects () + (mapcar + (lambda (project) + (list + (project-name project) + (project-src project))) + *all-project*))