From 23497607bf7ec831dd57bf06bf6cd802c3ec6b8a Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 16 Mar 2023 12:00:35 -0700 Subject: new reader macros for shell- and Perl-style matching & replacement Signed-off-by: Sean Whitton --- src/util.lisp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/util.lisp') 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 -- cgit v1.2.3