X-Git-Url: https://git.distorted.org.uk/~mdw/lisp/blobdiff_plain/a8bbb2e72e8c8f9168520d92c7d8a01377928e91..2c13c1cd713e033763786de1ce9fc66565abb5df:/optparse.lisp diff --git a/optparse.lisp b/optparse.lisp index 5f28365..ff301ee 100644 --- a/optparse.lisp +++ b/optparse.lisp @@ -446,13 +446,15 @@ Ambiguous long option `~A' -- could be any of:~{~% --~A~}" on some parameters (the ARGS) and the value of an option-argument named ARG." (let ((func (intern (format nil "OPTHANDLER/~:@(~A~)" name)))) - `(progn - (setf (get ',name 'opthandler) ',func) - (defun ,func (,var ,arg ,@args) - (with-locatives ,var - (declare (ignorable ,arg)) - ,@body)) - ',name))) + (multiple-value-bind (docs decls body) (parse-body body) + `(progn + (setf (get ',name 'opthandler) ',func) + (defun ,func (,var ,arg ,@args) + ,@docs ,@decls + (with-locatives ,var + (declare (ignorable ,arg)) + ,@body)) + ',name)))) (defun parse-c-integer (string &key radix (start 0) end) "Parse STRING, or at least the parts of it between START and END, according