changeset 317: |
1f14280be401 |
parent: |
58aea6421176
|
child: |
c5956756f9e5 |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Wed, 08 May 2024 21:34:08 -0400 |
permissions: |
-rw-r--r-- |
description: |
repl tweaks |
2 (uiop:define-package :bin/skel 3 (:use :cl :std :cli/clap :vc :sb-ext) 4 (:use-reexport :skel :log) 10 (defopt skc-help (print-help $cli)) 11 (defopt skc-version (print-version $cli)) 12 (defopt skc-log *log-level* (when $val (setq *log-level* :debug))) 14 ;; TODO 2023-10-13: almost there 17 (init-user-skelrc (parse-file-opt $val)))) 21 (describe (init-user-skelrc (parse-file-opt (car $args)))) 22 (if (probe-file *user-skelrc*) 23 (describe (load-user-skelrc)) 24 (describe (init-user-skelrc))))) 27 (let ((file (or (when $args (pop $args)) (find-skelfile #P".")))) 28 (cli/ed:run-emacsclient (namestring file)))) 31 (let ((file (when $args (pop $args))) 32 (name (if (> $argc 1) (pop $args)))) 36 (uiop:println (format nil "file already exists: ~A" (or file *default-skelfile*))) 37 (let ((f2 (read-line))) 41 (init-skelfile file name)))) 46 (if $args (pathname (car $args)) 51 (sb-ext:enable-debugger) 54 (if $args (pathname (car $args)) 59 (println (std:format-sxhash (obj/id:id (find-skelfile #P"." :load t))))) 64 (let ((sel (trace! (pop $args)))) 65 (std/string:string-case (sel :default (nyi!)) 66 ("id" (std:format-sxhash (obj/id:id (find-skelfile #P"." :load t)))))) 67 (find-skelfile #P"." :load t)))) 70 (case (sk-vc (find-skelfile #P"." :load t)) 71 (:hg (run-hg-command "push" $args t)))) 74 (case (sk-vc (find-skelfile #P"." :load t)) 75 (:hg (run-hg-command "pull" (push "-u" $args) t)))) 78 (case (sk-vc (find-skelfile #P"." :load t)) 80 (let ((proc (run-hg-command "status" nil :stream))) 81 (copy-stream (process-output proc) *standard-output*) 84 (let ((proc (run-git-command "status" nil :stream))) 85 (copy-stream (process-output proc) *standard-output*) 90 (mapc (lambda (rule) (debug! (sk-run (sk-find-rule rule (find-skelfile #P"." :load t))))) $args) 91 (debug! (sk-run (aref (sk-rules (find-skelfile #P"." :load t)) 0))))) 95 (mapc (lambda (script) (debug! (sk-run (sk-find-script script (find-skelfile #P"." :load t))))) $args) 96 (required-argument :script))) 103 (use-package :std-user) 104 ;; (sb-ext:enable-debugger) 105 (require :sb-aclrepl) 107 (sb-impl::toplevel-repl nil)))) 112 :description "A hacker's project compiler and build tool." 115 (:name "help" :global t :description "print this message" 117 (:name "version" :global t :description "print version" 119 (:name "level" :global t :description "set log level (debug,info,trace,warn)" 121 (:name "config" :global t :description "set a custom skel user config" :kind file 123 (:name "input" :global t :description "input source" :kind string) 124 (:name "output" :global t :description "output target" :kind string)) 127 :description "initialize a skelfile in the current directory" 128 :opts (make-opts (:name "name" :description "project name" :kind string)) 131 :description "describe a skelfile" 134 :opts (make-opts (:name "file" :description "skelrc file" :kind file)) 137 :description "show project slots" 139 (:name "file" :description "path to skelfile" :kind file) 140 (:name "user" :description "print user configuration") 141 (:name "system" :description "print system configuration")) 144 :description "print the project id" 147 :description "inspect the project skelfile" 148 :opts (make-opts (:name "file" :description "path to skelfile" :kind file)) 151 :description "build project targets" 152 :opts (make-opts (:name "target" :description "target to build" :kind string)) 155 :description "run a script or command" 158 :description "print the vc status" 161 :description "push the current project upstream" 164 :description "pull the current project from remote" 167 :description "clone a remote project") 169 :description "commit changes to the project vc") 171 :description "edit a project file in emacs." 174 :description "open the sk-shell interpreter" 178 (let ((*log-level* :info)) 179 (in-readtable :shell) 180 (with-cli (opts cmds) $cli 182 ;; TODO 2024-01-01: need to parse out CMD opts from args slot - they still there 183 (do-opt (find-opt $cli "level")) 189 (sb-ext:exit :code 0))