From 12eab8cb4324cfbf9f6d8778044683fa3492bde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Breannd=C3=A1n=20=C3=93=20Nuall=C3=A1in?= Date: Fri, 4 Jul 2025 16:02:15 +0200 Subject: [PATCH] Add option for comma separated lists Useful, for example, for --extensions md,org,txt --- src/options.lisp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/options.lisp b/src/options.lisp index 449d5ef..59b426a 100644 --- a/src/options.lisp +++ b/src/options.lisp @@ -325,6 +325,16 @@ (write-string (call-next-method) s) (format s ":_files"))) +(defclass option-csv (option-string) + () + (:documentation "An option which represents a comma-separated list")) + +(defmethod make-option ((kind (eql :csv)) &rest rest) + (apply #'make-instance 'option-csv rest)) + +(defmethod finalize-option ((o option-csv) &key) + (setf (option-value o) (cl-ppcre:split "," (option-value o)))) + ;;;; ;;;; Boolean options ;;;;