1.1--- a/lisp/lib/cli/clap.lisp Mon Jun 03 19:42:39 2024 -0400
1.2+++ b/lisp/lib/cli/clap.lisp Mon Jun 03 22:08:03 2024 -0400
1.3@@ -4,9 +4,10 @@
1.4
1.5 ;;; Code:
1.6 (in-package :cli/clap)
1.7-(declaim (optimize (speed 3)))
1.8-(defun cli-arg0 () (car sb-ext:*posix-argv*))
1.9-(defun cli-args () (cdr sb-ext:*posix-argv*))
1.10+;; (declaim (optimize (speed 3) (debug 1)))
1.11+
1.12+(defun arg0 () (car sb-ext:*posix-argv*))
1.13+(defun args () (cdr sb-ext:*posix-argv*))
1.14
1.15 (declaim (simple-string *cli-group-separator*))
1.16 (defparameter *cli-group-separator*
1.17@@ -16,7 +17,7 @@
1.18 ;; uiop:command-line-arguments
1.19
1.20 ;;; Macros
1.21-(defmacro argp (arg &optional (args (cli-args)))
1.22+(defmacro argp (arg &optional (args (args)))
1.23 "Test for presence of ARG in ARGS. Return the tail of
1.24 ARGS starting from the position of ARG."
1.25 `(member ,arg ,args :test 'equal))
1.26@@ -34,7 +35,7 @@
1.27 ;; (invoke-restart (find-restart 'discard-argument condition)))
1.28 (deferror clap-error (std-error) () (:auto t))
1.29
1.30-(defvar *no-exit* nil
1.31+(defparameter *no-exit* nil
1.32 "Indicate whether the WITH-CLI-HANDLERS form should exit on completion.")
1.33
1.34 (defmacro with-cli-handlers (&body body)
1.35@@ -56,7 +57,7 @@
1.36 "Like with-slots with some extra bindings."
1.37 `(progn
1.38 (setf (cli-cd ,cli) (sb-posix:getcwd))
1.39- (with-slots ,slots (parse-args ,cli (cli-args) :compile t)
1.40+ (with-slots ,slots (parse-args ,cli (args) :compile t)
1.41 ,@body)))
1.42
1.43 (defvar *default-cli-def* 'defparameter)
1.44@@ -317,7 +318,7 @@
1.45 (list (make-shorty n) n))
1.46 (if (cli-opt-global self) "* " " ")
1.47 (if-let ((d (and (slot-boundp self 'description) (cli-opt-description self))))
1.48- (format stream ": ~A" (the simple-string d))
1.49+ (format stream ": ~A" d)
1.50 "")))
1.51
1.52 (defmethod cli-equal ((a cli-opt) (b cli-opt))