From 684f9167b20754b9a7524ae875d87e4fc7c6e14e Mon Sep 17 00:00:00 2001 From: Raymond Toy Date: Fri, 26 Jul 2024 14:47:04 -0700 Subject: [PATCH] Clean up implementation of printing options table Rename `*maxima-options*` to `*maxima-commandline-options*` to make it clearer what it contains. Add a docstring for `list-cl-options`. --- src/command-line.lisp | 7 ++++--- src/init-cl.lisp | 13 +++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/command-line.lisp b/src/command-line.lisp index 5e9fb4edc..e58c69b88 100644 --- a/src/command-line.lisp +++ b/src/command-line.lisp @@ -71,10 +71,11 @@ (format t " ~a" help-string)) (defun list-cl-options (cl-option-list &key texi-table-form) + "Prints all the command line options for Maxima in a neat form. If + :TEXI-TABLE-FORM is non-NIL, the output is suitable for adding a + table to commandline-options.texi." (if texi-table-form - (format t "@need 100 -@table @code -") + (format t "@need 100~%@table @code~%") (format t "options:~%")) (dolist (opt cl-option-list) (let ((help-string (cl-option-help-string opt)) diff --git a/src/init-cl.lisp b/src/init-cl.lisp index 932ea78be..e8f4c3241 100644 --- a/src/init-cl.lisp +++ b/src/init-cl.lisp @@ -390,7 +390,7 @@ (format t "version ~a, lisp ~a~%" (unix-like-basename version) lisp-string)))) (bye))) -(defvar *maxima-options* nil +(defvar *maxima-commandline-options* nil "All of the recognized command line options for maxima") (defun process-maxima-args (input-stream batch-flag) @@ -408,7 +408,12 @@ ;; but extraneous white space is ok. They are automatically ;; printed with extraneous whitespace (including newlines) removed ;; and lines wrapped neatly. - (setf *maxima-options* + ;; + ;; NOTE: If you add or remove command-line options, be sure to + ;; update doc/info/commandline-options.texi. Use (list-cl-options + ;; *maxima-commandline-options* :texi-table-form t) to get the table + ;; to paste into commandline-options.texi. + (setf *maxima-commandline-options* (list (make-cl-option :names '("-b" "--batch") :argument "" @@ -456,7 +461,7 @@ (make-cl-option :names '("-h" "--help") :action #'(lambda () (format t "usage: maxima [options]~%") - (list-cl-options *maxima-options*) + (list-cl-options *maxima-commandline-options*) (bye)) :help-string "Display this usage message.") (make-cl-option :names '("--userdir") @@ -590,7 +595,7 @@ (setf *verify-html-index* nil)) :help-string "Do not verify on startup that the set of html topics is consistent with text topics.") )) - (process-args (get-application-args) *maxima-options*) + (process-args (get-application-args) *maxima-commandline-options*) (values input-stream batch-flag)) -- 2.11.4.GIT