Better formatting for option help.
authorLevente Mészáros <levente.meszaros@gmail.com>
Fri, 25 Sep 2009 12:05:01 +0000 (14:05 +0200)
committerLevente Mészáros <levente.meszaros@gmail.com>
Fri, 25 Sep 2009 12:13:52 +0000 (14:13 +0200)
Format multiline documentation properly indented,
that is each line should start at the same column.
Print option type too and use little bit wider tabs.

parse-command-line-arguments.lisp

index 8801a6f..7e5ce19 100644 (file)
@@ -369,20 +369,24 @@ or what's currently left of them as they are processed")
           (unless (consp names)
             (setf names (list names)))
           (when documentation
-            (format stream "~& ~25A  ~A~:[~*~; (default: ~S)~]~%"
+            (format stream "~& ~32A ~8A ~@<~@;~A~@:>"
                     (format nil "~{ ~A~}" (mapcar 'option-name names))
-                    documentation
-                    initial-value-p initial-value))
+                    (string-downcase type)
+                    documentation)
+            (format stream "~:[~*~; (default: ~S)~]~%" initial-value-p initial-value))
           (when negation-documentation
-            (format stream " ~25A  ~A~%"
+            (format stream " ~32A ~8A ~@<~@;~A~@:>~%"
                     (format nil "~{ ~A~}" (mapcar 'option-name (make-negated-names names negation)))
+                    (string-downcase type)
                     negation-documentation)))))
 
 #| Testing:
 
 (defparameter *opt-spec*
  '((("all" #\a) :type boolean :documentation "do it all")
-   ("blah" :type string :initial-value "blob" :documentation "blah")
+   ("blah" :type string :initial-value "blob" :documentation "This is a very long multi line documentation.
+The function SHOW-OPTION-HELP should display this properly indented, that is
+all lines should start at the same column.")
    (("verbose" #\v) :type boolean :documentation "include debugging output")
    (("file" #\f) :type string :documentation "read from file instead of standard input")
    (("xml-port" #\x) :type integer :optional t :documentation "specify port for an XML listener")