aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-05-25 12:32:38 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-05-25 12:37:15 -0700
commitc4316097570c8a3b961b6aa08280eb92e4a16ae8 (patch)
treea672993c7a80578b4c226943ce326886c20e06b9
parent3017eac13c02808e02d1d05b0de5371928623a9b (diff)
downloadconsfigurator-c4316097570c8a3b961b6aa08280eb92e4a16ae8.tar.gz
add FILE:CONTAINS-CONF-TAB
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/package.lisp1
-rw-r--r--src/property/file.lisp8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/package.lisp b/src/package.lisp
index a84520a..192fc23 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -269,6 +269,7 @@
#:host-secret-uploaded
#:contains-conf-equals
#:contains-conf-space
+ #:contains-conf-tab
#:contains-conf-shell
#:contains-ini-settings
#:regex-replaced-lines
diff --git a/src/property/file.lisp b/src/property/file.lisp
index 0107809..e4e0a3d 100644
--- a/src/property/file.lisp
+++ b/src/property/file.lisp
@@ -323,6 +323,14 @@ uncommented and used to set the value, if it exists."
:parse-kv #?/^(\S+)\s+(.+)/
:new-kv (lambda (k v) #?"${k} ${v}"))))
+(defprop contains-conf-tab :posix (file &rest pairs)
+ "Like FILE:CONTAINS-CONF-SPACE, but separate keys and values with a tab rather
+than a space when updating lines."
+ (:desc (format nil "~A has ~{\"~A ~A\"~^, ~}" file pairs))
+ (:apply (simple-conf-update file pairs
+ :parse-kv #?/^(\S+)\s+(.+)/
+ :new-kv (lambda (k v) #?"${k} ${v}"))))
+
(defprop contains-conf-equals :posix (file &rest pairs)
"Where FILE is a config file in which keys and values are separated by \" = \"
and there are no sections, and PAIRS is a list of even length of alternating