optparse: Hack pretty-printing for CLisp.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 19 Apr 2008 21:33:51 +0000 (22:33 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 19 Apr 2008 21:33:51 +0000 (22:33 +0100)
CLisp's pretty printing is buggy, but we can get much closer by
doing some simple reordering of the existing code.

optparse.lisp

index b490b37..1322e10 100644 (file)
    a single string is sufficient."
   (pprint-logical-block (stream nil :prefix "Usage: ")
     (dolist (u (listify usage))
-      (pprint-logical-block (stream nil :prefix (format nil "~A " prog))
+      (pprint-logical-block (stream nil
+                                   :prefix (concatenate 'string prog " "))
        (format stream "~{~A ~:_~}" (listify u)))
       (pprint-newline :mandatory stream))))
 
              (t
               (setf newlinep t)
               (pprint-logical-block (stream nil :prefix "  ")
-                (pprint-indent :block 30 stream)
                 (format stream "~:[   ~;-~:*~C,~] --~A"
                         (opt-short-name o)
                         (opt-long-name o))
                           (opt-arg-name o)))
                 (write-string "  " stream)
                 (pprint-tab :line 30 1 stream)
+                (pprint-indent :block 30 stream)
                 (print-text doc stream))
               (terpri stream)))))))