Minor cleanups.

This commit is contained in:
Brit Butler 2013-04-26 10:14:14 -04:00
parent a30405de7c
commit 25c8bc11ea
2 changed files with 9 additions and 5 deletions

View file

@ -67,7 +67,7 @@
(defun find-all (content-type) (defun find-all (content-type)
"Return a list of all instances of a given CONTENT-TYPE." "Return a list of all instances of a given CONTENT-TYPE."
(loop for val being the hash-values in *content* (loop for val being the hash-values in *content*
when (eql content-type (type-of val)) collect val)) when (typep val content-type) collect val))
(defun purge-all (content-type) (defun purge-all (content-type)
"Remove all instances of CONTENT-TYPE from *content*." "Remove all instances of CONTENT-TYPE from *content*."

View file

@ -1,9 +1,13 @@
(in-package :coleslaw) (in-package :coleslaw)
(defun fmt (fmt-str &rest args)
"A convenient FORMAT interface for string building."
(apply 'format nil fmt-str args))
(defun rel-path (base path &rest args) (defun rel-path (base path &rest args)
"Take a relative PATH and return the corresponding pathname beneath BASE. "Take a relative PATH and return the corresponding pathname beneath BASE.
If ARGS is provided, use (apply 'format nil PATH ARGS) as the value of PATH." If ARGS is provided, use (fmt path args) as the value of PATH."
(merge-pathnames (apply 'format nil path args) base)) (merge-pathnames (fmt path args) base))
(defun app-path (path &rest args) (defun app-path (path &rest args)
"Return a relative path beneath coleslaw." "Return a relative path beneath coleslaw."
@ -11,8 +15,8 @@ If ARGS is provided, use (apply 'format nil PATH ARGS) as the value of PATH."
(defun run-program (program &rest args) (defun run-program (program &rest args)
"Take a PROGRAM and execute the corresponding shell command. If ARGS is provided, "Take a PROGRAM and execute the corresponding shell command. If ARGS is provided,
use (apply 'format nil PROGRAM ARGS) as the value of PROGRAM." use (fmt program args) as the value of PROGRAM."
(inferior-shell:run (apply 'format nil program args) :show t)) (inferior-shell:run (fmt program args) :show t))
(defun update-symlink (path target) (defun update-symlink (path target)
"Update the symlink at PATH to point to TARGET." "Update the symlink at PATH to point to TARGET."