From: Frank Duncan Date: Fri, 10 Dec 2021 13:05:01 +0000 (-0600) Subject: Add git interface function X-Git-Url: https://code.consxy.com/gitweb/?a=commitdiff_plain;h=466f798b43a50f1febcab5518d8c8e1983ff9f3a;p=candle Add git interface function --- diff --git a/candle.asd b/candle.asd index 0dbb24c..55de875 100644 --- a/candle.asd +++ b/candle.asd @@ -5,5 +5,5 @@ :author "Frank Duncan (frank@consxy.com)" :serial t :pathname "src/main" - :components ((:file "package") (:file "base") (:file "server") (:file "cli") (:file "run")) + :components ((:file "package") (:file "base") (:file "server") (:file "cli") (:file "git") (:file "run")) :depends-on (:herbie-utility :opera)) diff --git a/src/main/git.lisp b/src/main/git.lisp new file mode 100644 index 0000000..065eb40 --- /dev/null +++ b/src/main/git.lisp @@ -0,0 +1,25 @@ +(in-package #:candle) + +(defvar *git-location* "/usr/bin/git") + +(defun git (project cmd &rest args) + (let + ((err nil) + (out nil) + (code nil)) + (setf + err + (with-output-to-string (err-str) + (setf out + (with-output-to-string (out-str) + (setf code + (sb-ext:process-exit-code + (sb-ext:run-program *git-location* + (append + (list "-C" (if project (project-dir project) *candle-dir*)) + (list cmd) + args) + :output out-str + :error err-str + :wait t))))))) + (values (zerop code) code out err)))