doc/check-docs: Return nonzero if discrepancies are found.
[sod] / src / optparse.lisp
index c901a9e..1de6dfe 100644 (file)
    RADIX may be nil to allow radix prefixes, or an integer between 2 and 36.
    An option-parse-error is signalled if the ARG is not a valid integer, or
    if it is not between MIN and MAX (either of which may be nil if no lower
-   resp. upper bound is wanted)."
+   or upper bound is wanted)."
   (multiple-value-bind (v end) (parse-c-integer arg :radix radix)
     (unless (and v (>= end (length arg)))
       (option-parse-error "Bad integer `~A'" arg))
     (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))
              (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)