aboutsummaryrefslogtreecommitdiff
path: root/src/util.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-03-16 12:00:35 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-03-16 19:05:06 -0700
commit23497607bf7ec831dd57bf06bf6cd802c3ec6b8a (patch)
treecb92d5897434af338d9bd1cceb255ff1bb9fca69 /src/util.lisp
parent8fa41a15f184660ab5bda5f86d645ba9b2582389 (diff)
downloadconsfigurator-23497607bf7ec831dd57bf06bf6cd802c3ec6b8a.tar.gz
new reader macros for shell- and Perl-style matching & replacement
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/util.lisp')
-rw-r--r--src/util.lisp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/util.lisp b/src/util.lisp
index 20a3714..fea974d 100644
--- a/src/util.lisp
+++ b/src/util.lisp
@@ -249,9 +249,7 @@ simple collections of readably-printable values."
(defun parse-username-from-id (output)
"Where OUTPUT is the output of the id(1) command, extract the username."
- (multiple-value-bind (match groups)
- (re:scan-to-strings "^uid=[0-9]+\\(([^)]+)" output)
- (and match (elt groups 0))))
+ (#1~/^uid=[0-9]+\(([^)]+)/ output))
(defun abbreviate-consfigurator-package (name)
(with-standard-io-syntax
@@ -421,11 +419,9 @@ on simple scripts embedded in source code, written with newlines for the sake
of maintainability. Converting those scripts to single lines before they are
executed improves Consfigurator's debug output, and also makes process names
visible to remote commands like ps(1) more readable."
- (re:regex-replace-all
- #?/\s+/ (re:regex-replace-all "(then|else|elif|fi|case|in|;;|do|done);"
- (format nil "~{~A~^; ~}" (lines script))
- "\\1")
- " "))
+ (#~s/\s+/ /g
+ (#~s/(then|else|elif|fi|case|in|;;|do|done);/\1/g
+ (format nil "~{~A~^; ~}" (lines script)))))
;;;; Progress & debug printing