diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-25 11:03:55 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-29 11:00:48 -0700 |
commit | 9a34a056f34335b5b1e4dde7f6e0b8ea28b27434 (patch) | |
tree | ebdf900678148a7deccd2b47429f03b2140ba1bc /src/connection.lisp | |
parent | e79f3c336e6d6c70421d25dd892c842f76516504 (diff) | |
download | consfigurator-9a34a056f34335b5b1e4dde7f6e0b8ea28b27434.tar.gz |
add REMOTE-EXISTS-{EVERY,SOME}-P, fix docstring grammar
Thanks to David Bremner for suggesting the names of the new functions.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection.lisp')
-rw-r--r-- | src/connection.lisp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index d051ad6..68a1404 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -542,12 +542,25 @@ subclass to the :HOSTATTRS subroutine of properties calling this." (alet (sh-escape (drop-trailing-slash (unix-namestring directory))) (mrun (format nil "rm -rf -- ~A/* ~A/.[!.]* ~A/..?*" it it it)))) +(defun remote-test-multiple (operator paths connective) + (apply #'remote-test (loop for path on paths + nconc (list operator (car path)) + when (cdr path) collect connective))) + (defun remote-exists-p (&rest paths) - "Does each of PATHS exists? + "Does each of PATHS exist? PATH may be any kind of file, including directories." - (apply #'remote-test (loop for path on paths - nconc (list "-e" (car path)) - when (cdr path) collect "-a"))) + (remote-test-multiple "-e" paths "-a")) + +(defun remote-exists-every-p (&rest paths) + "Does each of PATHS exist? +PATH may be any kind of file, including directories." + (remote-test-multiple "-e" paths "-a")) + +(defun remote-exists-some-p (&rest paths) + "Do any of PATHS exist? +PATH may be any kind of file, including directories." + (remote-test-multiple "-e" paths "-o")) (defun remote-file-stats (path) "Get the numeric mode, size in bytes, mtime, owner and group of PATH, or NIL if |