local/bin/recompress: Reorder.

master
Pierre Neidhardt 2020-11-06 14:27:13 +01:00
parent 47a0433471
commit 18dc2444a0
1 changed files with 18 additions and 16 deletions

View File

@ -21,6 +21,24 @@ If EXTENSIONS is empty, list all files."
subfiles))))))
result))
(defun make-directory (path)
(uiop:ensure-all-directories-exist (list (uiop:ensure-directory-pathname path)))
path)
(defun run (&rest arguments)
;; TODO: Hide stacktrace with `handler-case??
(uiop:run-program arguments
:output t
:error-output :output))
(defun assert-program (program &rest more-programs)
(dolist (p (cons program more-programs))
(or (sera:resolve-executable p)
(warn "~s not found" p)
(uiop:quit 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun list-files ()
(list-files-recursively
(first (uiop:command-line-arguments))
@ -45,16 +63,6 @@ If EXTENSIONS is empty, list all files."
(uiop:resolve-absolute-location ; TODO: Can we generate a temp dir in Common Lisp?
(list (uiop:temporary-directory) "recompress-mount/"))))
(defun make-directory (path)
(uiop:ensure-all-directories-exist (list (uiop:ensure-directory-pathname path)))
path)
(defun run (&rest arguments)
;; TODO: Hide stacktrace with `handler-case??
(uiop:run-program arguments
:output t
:error-output :output))
(defmacro with-mounted-archive (path &body body)
`(progn
(make-directory *archive-mount-point*)
@ -71,12 +79,6 @@ If EXTENSIONS is empty, list all files."
(apply #'run "apack" absolute-destination
(mapcar #'namestring (osicat:list-directory (uiop:getcwd) :bare-pathnames t)))))))
(defun assert-program (program &rest more-programs)
(dolist (p (cons program more-programs))
(or (sera:resolve-executable p)
(warn "~s not found" p)
(uiop:quit 1))))
(assert-program "apack" "archivemount")
(unless (= 2 (length (uiop:command-line-arguments)))