changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > core / lisp/lib/cli/clap/cli.lisp

revision 643: f901de70a80e
parent 626: cc13027df6fa
child 644: f59072409c7a
     1.1--- a/lisp/lib/cli/clap/cli.lisp	Sun Sep 08 21:14:30 2024 -0400
     1.2+++ b/lisp/lib/cli/clap/cli.lisp	Tue Sep 10 21:26:30 2024 -0400
     1.3@@ -53,11 +53,12 @@
     1.4            (t (make-cli :opt :name (format nil "~(~A~)" x) :global t))))
     1.5        opts))
     1.6 
     1.7-(defun make-cmds (cmds)
     1.8+(defun make-cmds (&rest cmds)
     1.9   "Make a vector of CLI-CMDs based on CMDS."
    1.10   (map 'vector
    1.11         (lambda (x)
    1.12           (etypecase x
    1.13+            (cli-cmd x)
    1.14             (string (make-cli :cmd :name x))
    1.15             (list (apply #'make-cli :cmd x))
    1.16             (t (make-cli :cmd :name (format nil "~(~A~)" x)))))
    1.17@@ -78,7 +79,7 @@
    1.18 (defmethod print-version ((self cli) &optional stream)
    1.19   (println (cli-version self) stream))
    1.20 
    1.21-(defmethod print-help ((self cli) &optional stream) 
    1.22+(defmethod print-help ((self cli) &optional (stream t)) 
    1.23   (println (format nil "~A v~A --- ~A~%" (cli-name self) (cli-version self) (cli-description self)) stream)
    1.24   (print-usage self stream)
    1.25   ;; (terpri stream)
    1.26@@ -86,12 +87,12 @@
    1.27   (with-slots (opts cmds) self
    1.28     (unless (null opts)
    1.29       (loop for o across opts
    1.30-            do (iprintln (print-usage o) 2 stream)))
    1.31+            do (iprintln (print-usage o nil) 2 stream)))
    1.32     (terpri stream)
    1.33     (println "commands:" stream)
    1.34     (unless (null cmds)
    1.35       (loop for c across cmds
    1.36-            do (iprintln (print-usage c) 2 stream)))))
    1.37+            do (iprintln (print-usage c nil) 2 stream)))))
    1.38 
    1.39 (defmethod cli-equal :before ((a cli) (b cli))
    1.40   "Return T if A is the same cli object as B.