From: Frank Duncan Date: Sat, 3 Jul 2021 12:05:52 +0000 (-0500) Subject: Add default to option argument X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?a=commitdiff_plain;h=d6dc94d9d021b88cbbfe6adcdef7b9c5b7b0c50b;p=opera Add default to option argument --- diff --git a/src/main/opera.lisp b/src/main/opera.lisp index b66a4c0..173ea48 100644 --- a/src/main/opera.lisp +++ b/src/main/opera.lisp @@ -187,8 +187,11 @@ (defun option-present (option-name parsed-options) (find option-name parsed-options :key #'car)) -(defun option-argument (option-name parsed-options) - (cadr (assoc option-name parsed-options))) +(defun option-argument (option-name parsed-options &optional default) + (if + (option-present option-name parsed-options) + (cadr (assoc option-name parsed-options)) + default)) (defun option-arguments (option-name parsed-options) (mapcar #'cadr (remove option-name parsed-options :key #'car :test-not #'eql)))