changeset 320: |
3e3cce6ed1f0 |
parent: |
c5956756f9e5
|
child: |
807018bcba4d |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Wed, 08 May 2024 23:13:13 -0400 |
permissions: |
-rw-r--r-- |
description: |
bugfix |
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-level *log-level* (setq *log-level* (or $val :info))) 14 ;; TODO 2023-10-13: almost there 16 (init-user-skelrc (when $val (parse-file-opt $val)))) 19 (let ((file (or (when $args (pop $args)) (find-skelfile #P".")))) 20 (cli/ed:run-emacsclient (namestring file)))) 23 (let ((file (when $args (pop $args))) 24 (name (if (> $argc 1) (pop $args)))) 28 (uiop:println (format nil "file already exists: ~A" (or file *default-skelfile*))) 29 (let ((f2 (read-line))) 33 (init-skelfile file name)))) 38 (if $args (pathname (car $args)) 43 (sb-ext:enable-debugger) 46 (if $args (pathname (car $args)) 51 (println (std:format-sxhash (obj/id:id (find-skelfile #P"." :load t))))) 53 (defun skc-show-case (sel) 54 (std/string:string-case (sel :default (nyi!)) 55 (":id" (std:format-sxhash (obj/id:id (find-skelfile #P"." :load t)))) 56 (":config" (if (probe-file *user-skelrc*) 57 (describe (load-user-skelrc) t) 58 (describe *skel-user-config* nil))) 59 (":vc" (sk-vc (find-skelfile #P"." :load t))) 60 (":author" (sk-author (find-skelfile #P"." :load t))) 61 (":scripts" (sk-scripts (find-skelfile #P"." :load t))) 62 (":rules" (sk-rules (find-skelfile #P"." :load t))) 63 (":description" (sk-description (find-skelfile #P"." :load t))) 64 (":tags" (sk-tags (find-skelfile #P"." :load t))) 65 (":docs" (sk-docs (find-skelfile #P"." :load t))) 66 (":version" (sk-version (find-skelfile #P"." :load t))) 67 (":imports" (sk-imports (find-skelfile #P"." :load t))) 68 (":license" (sk-license (find-skelfile #P"." :load t))) 69 (":stash" (sk-stash (find-skelfile #P"." :load t))) 70 (":store" (sk-store (find-skelfile #P"." :load t))) 71 (":cache" (sk-cache (find-skelfile #P"." :load t))))) 75 (mapc (lambda (x) (when-let ((ret (skc-show-case x))) (println ret))) $args) 76 (describe (find-skelfile #P"." :load t)))) 79 (case (sk-vc (find-skelfile #P"." :load t)) 80 (:hg (run-hg-command "push" $args t)))) 83 (case (sk-vc (find-skelfile #P"." :load t)) 84 (:hg (run-hg-command "pull" (push "-u" $args) t)))) 87 (case (sk-vc (find-skelfile #P"." :load t)) 89 (let ((proc (run-hg-command "status" nil :stream))) 90 (copy-stream (process-output proc) *standard-output*) 93 (let ((proc (run-git-command "status" nil :stream))) 94 (copy-stream (process-output proc) *standard-output*) 99 (mapc (lambda (rule) (debug! (sk-run (sk-find-rule rule (find-skelfile #P"." :load t))))) $args) 100 (debug! (sk-run (aref (sk-rules (find-skelfile #P"." :load t)) 0))))) 104 (mapc (lambda (script) (debug! (sk-run (sk-find-script script (find-skelfile #P"." :load t))))) $args) 105 (required-argument :script))) 112 (use-package :std-user) 113 ;; (sb-ext:enable-debugger) 114 (require :sb-aclrepl) 116 (sb-impl::toplevel-repl nil)))) 121 :description "A hacker's project compiler and build tool." 124 (:name "help" :global t :description "print this message" 126 (:name "version" :global t :description "print version" 128 (:name "level" :global t :description "set log level (debug,info,trace,warn)" 130 (:name "config" :global t :description "set a custom skel user config" :kind file 132 (:name "input" :global t :description "input source" :kind string) 133 (:name "output" :global t :description "output target" :kind string)) 136 :description "initialize a skelfile in the current directory" 137 :opts (make-opts (:name "name" :description "project name" :kind string)) 140 :description "describe a skelfile" 143 :description "show project slots" 145 (:name "file" :description "path to skelfile" :kind file) 146 (:name "user" :description "print user configuration") 147 (:name "system" :description "print system configuration")) 150 :description "print the project id" 153 :description "inspect the project skelfile" 154 :opts (make-opts (:name "file" :description "path to skelfile" :kind file)) 157 :description "build project targets" 158 :opts (make-opts (:name "target" :description "target to build" :kind string)) 161 :description "run a script or command" 164 :description "print the vc status" 167 :description "push the current project upstream" 170 :description "pull the current project from remote" 173 :description "clone a remote project") 175 :description "commit changes to the project vc") 177 :description "edit a project file in emacs." 180 :description "open the sk-shell interpreter" 184 (let ((*log-level* :info)) 185 (in-readtable :shell) 186 (with-cli (opts cmds) $cli 188 ;; TODO 2024-01-01: need to parse out CMD opts from args slot - they still there 189 (do-opt (find-opt $cli "level")) 195 (sb-ext:exit :code 0))