chiark / gitweb /
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 b490b37b51fb7f966cc8f1a538a3802b985c3841..1322e109f919c34b41d6b5e82aae9e7bdf402b97 100644 (file)
@@ -859,7 +859,8 @@ (defun show-usage (prog usage &optional (stream *standard-output*))
    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))))
 
@@ -880,7 +881,6 @@ (defun show-options-help (opts &optional (stream *standard-output*))
              (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))
@@ -890,6 +890,7 @@ (defun show-options-help (opts &optional (stream *standard-output*))
                           (opt-arg-name o)))
                 (write-string "  " stream)
                 (pprint-tab :line 30 1 stream)
+                (pprint-indent :block 30 stream)
                 (print-text doc stream))
               (terpri stream)))))))