1.1--- a/lisp/bin/skel.lisp Fri Jul 26 23:12:33 2024 -0400
1.2+++ b/lisp/bin/skel.lisp Fri Jul 26 23:55:27 2024 -0400
1.3@@ -14,25 +14,25 @@
1.4 (in-package :bin/skel)
1.5 (in-readtable :shell)
1.6
1.7-(defopt skc-help (print-help $cli) $val)
1.8-(defopt skc-version (print-version $cli))
1.9+(defopt skc-help (print-help *cli*) *arg*)
1.10+(defopt skc-version (print-version *cli*))
1.11 (defopt skc-level *log-level*
1.12- (setq *log-level* (if $val (if (stringp $val)
1.13- (sb-int:keywordicate (string-upcase $val))
1.14- $val)
1.15+ (setq *log-level* (if *arg* (if (stringp *arg*)
1.16+ (sb-int:keywordicate (string-upcase *arg*))
1.17+ *arg*)
1.18 :info)))
1.19
1.20 ;; TODO 2023-10-13: almost there
1.21 ;; (defopt skc-config
1.22-;; (init-user-skelrc (when $val (parse-file-opt $val))))
1.23+;; (init-user-skelrc (when *arg* (parse-file-opt *arg*))))
1.24
1.25 (defcmd skc-edit
1.26- (let ((file (or (when $args (pop $args)) (sk-path *skel-project*))))
1.27+ (let ((file (or (when *args* (pop *args*)) (sk-path *skel-project*))))
1.28 (cli/ed:run-emacsclient (namestring file))))
1.29
1.30 (defcmd skc-init
1.31- (let ((file (when $args (pop $args)))
1.32- (name (when (> $argc 1) (pop $args)))) ;; TODO: test, may need to be
1.33+ (let ((file (when *args* (pop *args*)))
1.34+ (name (when (> *argc* 1) (pop *args*)))) ;; TODO: test, may need to be
1.35 ;; sequential for side-effect
1.36 ;; of pop
1.37 (handler-bind
1.38@@ -47,8 +47,8 @@
1.39
1.40 (defcmd skc-describe
1.41 (describe
1.42- (if (> $argc 0)
1.43- (find-skelfile (pathname (car $args)) :load t)
1.44+ (if (> *argc* 0)
1.45+ (find-skelfile (pathname (car *args*)) :load t)
1.46 (or *skel-project* *skel-user-config* *skel-system-config*))))
1.47
1.48
1.49@@ -57,14 +57,14 @@
1.50 (setq *no-exit* t)
1.51 (inspect
1.52 (find-skelfile
1.53- (if $args (pathname (car $args))
1.54+ (if *args* (pathname (car *args*))
1.55 #P".")
1.56 :load t)))
1.57
1.58 #+tools
1.59 (defcmd skc-view
1.60- (if $args
1.61- (let ((stuff (loop for a in $args
1.62+ (if *args*
1.63+ (let ((stuff (loop for a in *args*
1.64 collect (sk-slot-case a))))
1.65 (sk-view (if (= 1 (length stuff)) (car stuff) stuff)))
1.66 (sk-view (if (boundp '*skel-project*) *skel-project*
1.67@@ -132,8 +132,8 @@
1.68 (":cache" (sk-cache *skel-user-config*))))
1.69
1.70 (defcmd skc-show
1.71- (if $args
1.72- (mapc (lambda (x) (when-let ((ret (sk-slot-case x))) (println ret))) $args)
1.73+ (if *args*
1.74+ (mapc (lambda (x) (when-let ((ret (sk-slot-case x))) (println ret))) *args*)
1.75 (describe (if (boundp '*skel-project*) *skel-project*
1.76 (if (boundp '*skel-user-config*) *skel-user-config*
1.77 (if (boundp '*skel-system-config*) *skel-system-config*
1.78@@ -141,14 +141,14 @@
1.79
1.80 (defcmd skc-push
1.81 (case (sk-vc-meta-kind (sk-vc (find-skelfile #P"." :load t)))
1.82- (:git (run-git-command "push" $args t))
1.83- (:hg (run-hg-command "push" $args t))
1.84+ (:git (run-git-command "push" *args* t))
1.85+ (:hg (run-hg-command "push" *args* t))
1.86 (t (skel-simple-error "unknown VC type"))))
1.87
1.88 (defcmd skc-pull
1.89 (case (sk-vc-meta-kind (sk-vc (find-skelfile #P"." :load t)))
1.90- (:git (run-git-command "pull" $args t))
1.91- (:hg (run-hg-command "pull" (append '("-u") $args) t))
1.92+ (:git (run-git-command "pull" *args* t))
1.93+ (:hg (run-hg-command "pull" (append '("-u") *args*) t))
1.94 (t (skel-simple-error "unknown VC type"))))
1.95
1.96 (defun hg-status ()
1.97@@ -171,44 +171,44 @@
1.98
1.99 (defcmd skc-clone
1.100 (case (sk-vc-meta-kind (sk-vc (find-skelfile #P"." :load t)))
1.101- (:git (run-git-command "clone" $args t))
1.102- (:hg (run-hg-command "clone" $args t))
1.103+ (:git (run-git-command "clone" *args* t))
1.104+ (:hg (run-hg-command "clone" *args* t))
1.105 (t (skel-simple-error "unknown VC type"))))
1.106
1.107 (defcmd skc-commit
1.108- ;; (debug! $optc $argc)
1.109+ ;; (debug! *optc* *argc*)
1.110 (case (sk-vc-meta-kind (sk-vc (find-skelfile #P"." :load t)))
1.111- (:git (run-git-command "commit" $args t))
1.112- (:hg (run-hg-command "commit" $args t))
1.113+ (:git (run-git-command "commit" *args* t))
1.114+ (:hg (run-hg-command "commit" *args* t))
1.115 (t (skel-simple-error "unknown VC type"))))
1.116
1.117 (defcmd skc-make
1.118 (let ((sk (find-skelfile #P"." :load t)))
1.119 (sb-ext:enable-debugger)
1.120- (print $args)
1.121+ (print *args*)
1.122 ;; (setq *no-exit* t)
1.123- (if $args
1.124- (loop for a in $args
1.125+ (if *args*
1.126+ (loop for a in *args*
1.127 do (debug!
1.128 (when-let ((rule (sk-find-rule a sk)))
1.129 (sk-make sk rule))))
1.130 (debug! (sk-make sk (aref (sk-rules sk) 0))))))
1.131
1.132 (defcmd skc-run
1.133- (if $args
1.134+ (if *args*
1.135 (mapc (lambda (script)
1.136 (debug!
1.137 (sk-run
1.138 (sk-find-script
1.139 (pathname-name script)
1.140- (find-skelfile #P"." :load t))))) $args)
1.141+ (find-skelfile #P"." :load t))))) *args*)
1.142 (required-argument 'name)))
1.143
1.144 (defcmd skc-vc
1.145- (if $args
1.146- (std/string:string-case ((car $args) :default (skel-simple-error "invalid command"))
1.147+ (if *args*
1.148+ (std/string:string-case ((car *args*) :default (skel-simple-error "invalid command"))
1.149 ("status" (skc-status nil nil)))
1.150- (skc-status nil $opts)))
1.151+ (skc-status nil *opts*)))
1.152
1.153 (defcmd skc-shell
1.154 (sb-ext:enable-debugger)
1.155@@ -225,9 +225,9 @@
1.156 (sb-impl::toplevel-repl nil))))
1.157
1.158 (defcmd skc-new
1.159- (trace! $args $opts))
1.160+ (trace! *args* *opts*))
1.161
1.162-(define-cli $cli
1.163+(define-cli *cli*
1.164 :name "skel"
1.165 :version #.(format nil "0.1.1:~A" (read-line (sb-ext:process-output (vc:run-hg-command "id" '("-i") :stream))))
1.166 :description "A hacker's project compiler."
1.167@@ -346,9 +346,9 @@
1.168 (in-package :sk-user)
1.169 (let ((*log-level* :info))
1.170 (in-readtable :shell)
1.171- (with-cli (opts cmds) $cli
1.172+ (with-cli (opts cmds) *cli*
1.173 (init-skel-vars)
1.174 (when-let ((project (find-skelfile #P".")))
1.175 (setq *skel-project* (load-skelfile project)))
1.176- (do-cmd $cli)
1.177- (debug-opts $cli))))
1.178+ (do-cmd *cli*)
1.179+ (debug-opts *cli*))))