diff --git a/lisp/update-git.lisp b/lisp/update-git.lisp index aa60b80..0f6cb47 100644 --- a/lisp/update-git.lisp +++ b/lisp/update-git.lisp @@ -3,21 +3,24 @@ (:use :cl :roswell.util)) (in-package :roswell.update.git) -(defun git (path) - (unless (pathnamep path) - (setf path (make-pathname - :type nil :name nil - :defaults (asdf:system-source-file (asdf:find-system path))))) - (when (probe-file (merge-pathnames ".git/" path)) - (format *error-output* "git pull on ~A~%" path) - (unless (roswell.util:which "git") - (format *error-output* "git command not found~%") - (ros:quit 1)) - (multiple-value-bind (o e exit-code) - (uiop/run-program:run-program - `(,(sh) "-lc" ,(format nil "cd ~S;git pull" (uiop:native-namestring path))) - :output t :error-output t :ignore-error-status t) - (declare (ignore o e)) - (unless (zerop exit-code) - (ros:quit exit-code))) - t)) +(defun git (&rest args) + (if (car args) + (let ((path (car args))) + (unless (pathnamep path) + (setf path (make-pathname + :type nil :name nil + :defaults (asdf:system-source-file (asdf:find-system path))))) + (when (probe-file (merge-pathnames ".git/" path)) + (format *error-output* "git pull on ~A~%" path) + (unless (roswell.util:which "git") + (format *error-output* "git command not found~%") + (ros:quit 1)) + (multiple-value-bind (o e exit-code) + (uiop/run-program:run-program + `(,(sh) "-lc" ,(format nil "cd ~S;git pull" (uiop:native-namestring path))) + :output t :error-output t :ignore-error-status t) + (declare (ignore o e)) + (unless (zerop exit-code) + (ros:quit exit-code))) + t)) + (format *error-output* "No path supplied"))) diff --git a/lisp/update-hg.lisp b/lisp/update-hg.lisp index 736d6c9..d846df3 100644 --- a/lisp/update-hg.lisp +++ b/lisp/update-hg.lisp @@ -3,21 +3,24 @@ (:use :cl :roswell.util)) (in-package :roswell.update.hg) -(defun hg (path) - (unless (pathnamep path) - (setf path (make-pathname - :type nil :name nil - :defaults (asdf:system-source-file (asdf:find-system path))))) - (when (probe-file (merge-pathnames ".hg/" path)) - (format *error-output* "hg pull and update on ~A~%" path) - (unless (roswell.util:which "hg") - (format *error-output* "hg command not found~%") - (ros:quit 1)) - (multiple-value-bind (o e exit-code) - (uiop/run-program:run-program - `(,(sh) "-lc" ,(format nil "cd ~S;hg pull && hg update" (uiop:native-namestring path))) - :output t :error-output t :ignore-error-status t) - (declare (ignore o e)) - (unless (zerop exit-code) - (ros:quit exit-code))) - t)) +(defun hg (&rest args) + (if (car args) + (let ((path (car args))) + (unless (pathnamep path) + (setf path (make-pathname + :type nil :name nil + :defaults (asdf:system-source-file (asdf:find-system path))))) + (when (probe-file (merge-pathnames ".hg/" path)) + (format *error-output* "hg pull and update on ~A~%" path) + (unless (roswell.util:which "hg") + (format *error-output* "hg command not found~%") + (ros:quit 1)) + (multiple-value-bind (o e exit-code) + (uiop/run-program:run-program + `(,(sh) "-lc" ,(format nil "cd ~S;hg pull && hg update" (uiop:native-namestring path))) + :output t :error-output t :ignore-error-status t) + (declare (ignore o e)) + (unless (zerop exit-code) + (ros:quit exit-code))) + t)) + (format *error-output* "No path supplied")))