[Git][cmucl/cmucl][issue-379-gnu-style-options] Update get-command-line-switch to recognize --foo as well

Raymond Toy pushed to branch issue-379-gnu-style-options at cmucl / cmucl Commits: 263c0448 by Raymond Toy at 2025-02-13T09:05:05-08:00 Update get-command-line-switch to recognize --foo as well Recognize "-foo" (as before) and also "--foo", which are converted to "foo". - - - - - 1 changed file: - src/code/commandline.lisp Changes: ===================================== src/code/commandline.lisp ===================================== @@ -149,7 +149,14 @@ the switch. If no value was specified, then any following words are returned. If there are no following words, then t is returned. If the switch was not specified, then nil is returned." - (let* ((name (if (char= (schar sname 0) #\-) (subseq sname 1) sname)) + (let* ((posn (position-if-not #'(lambda (ch) + (char= ch #\-)) + sname)) + ;; Strip up to 2 leading "-" to get the switch name. + ;; Otherwise, return the entire switch name. + (name (if (and posn (<= posn 2)) + (subseq sname posn) + sname)) (switch (find name *command-line-switches* :test #'string-equal :key #'cmd-switch-name))) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/263c0448e8e6888d9bc3d2ba... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/263c0448e8e6888d9bc3d2ba... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)