aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-11-25 11:03:55 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-11-29 11:00:48 -0700
commit9a34a056f34335b5b1e4dde7f6e0b8ea28b27434 (patch)
treeebdf900678148a7deccd2b47429f03b2140ba1bc /src
parente79f3c336e6d6c70421d25dd892c842f76516504 (diff)
downloadconsfigurator-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')
-rw-r--r--src/connection.lisp21
-rw-r--r--src/package.lisp2
2 files changed, 19 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
diff --git a/src/package.lisp b/src/package.lisp
index db29898..a576d3c 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -188,6 +188,8 @@
#:runlines
#:remote-test
#:remote-exists-p
+ #:remote-exists-every-p
+ #:remote-exists-some-p
#:remote-file-stats
#:remote-last-reboot
#:remote-executable-find