X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/7702b7bc88a97c15f955f62e8afbc40521ceec7b..d9bd7c90250b7563be98f105d0a53ce66d559ea0:/src/optparse.lisp diff --git a/src/optparse.lisp b/src/optparse.lisp index 7e444e0..5017fe4 100644 --- a/src/optparse.lisp +++ b/src/optparse.lisp @@ -207,7 +207,7 @@ (defstruct (option wrapped. If nil, the option is omitted from the help text. - Usually, one won't use make-option, but use the option macro instead." + Usually, one won't use `make-option', but use the `option' macro instead." (long-name nil :type (or null string)) (tag nil :type t) (negated-tag nil :type t) @@ -997,22 +997,25 @@ (defun show-options-help (opts &optional (stream *standard-output*)) (dolist (o opts) (let ((doc (opt-documentation o))) (cond ((not o)) - ((not (opt-long-name o)) + ((not (or (opt-short-name o) + (opt-long-name o))) (when newlinep (terpri stream) (setf newlinep nil)) (pprint-logical-block (stream nil) (print-text doc stream)) (terpri stream)) - (t + (doc (setf newlinep t) (pprint-logical-block (stream nil :prefix " ") - (format stream "~:[ ~;-~:*~C,~] --~A" + (format stream "~:[ ~;-~:*~C~:[~;,~]~:*~]~@[ --~A~]" (opt-short-name o) (opt-long-name o)) (when (opt-arg-name o) - (format stream "~:[=~A~;[=~A]~]" + (format stream + "~:[~;[~]~:[~0@*~:[ ~;~]~*~;=~]~A~0@*~:[~;]~]" (opt-arg-optional-p o) + (opt-long-name o) (opt-arg-name o))) (write-string " " stream) (pprint-tab :line 30 1 stream)