# HG changeset patch # User Richard Westhaver # Date 1720378209 14400 # Node ID d8a8a13a5cce320917edb435dd9b394d7711ffad # Parent d1f96f95a10c8f7ebc62280158e6c3411649f67a fixes diff -r d1f96f95a10c -r d8a8a13a5cce lisp/lib/skel/core/obj.lisp --- a/lisp/lib/skel/core/obj.lisp Sun Jul 07 02:14:24 2024 -0400 +++ b/lisp/lib/skel/core/obj.lisp Sun Jul 07 14:50:09 2024 -0400 @@ -129,13 +129,10 @@ (stash :initform *skel-stash* :initarg :stash :type pathname :accessor sk-stash) (cache :initform *skel-cache* :initarg :cache :type pathname :accessor sk-cache) (registry :initform *skel-registry* :initarg :registry :type pathname :accessor sk-registry) - (scripts :initarg :scripts :type (or pathname list (vector pathname)) :accessor sk-scripts) - (license :initarg :license :type license-designator :accessor sk-license) - (log-level :initarg :log-level :type log-level-designator) + (scripts :initform nil :initarg :scripts :type (or pathname list (vector pathname)) :accessor sk-scripts) + (license :initform nil :initarg :license :type license-designator :accessor sk-license) + (log-level :initform *log-level* :initarg :log-level :type log-level-designator) (fmt :initform :pretty :initarg :fmt :type symbol) - (alias-list :initarg :alias-list - :type (or list vector) - :documentation "alist of aliases. currently used as a special cli-opt-parser by the skel binary.") (auto-insert :initform nil :initarg :auto-insert :type form)) (:documentation "Root configuration class for the SKEL system. This class doesn't need to be exposed externally, but specifies all shared fields of SK-*-CONFIG types.")) diff -r d1f96f95a10c -r d8a8a13a5cce lisp/lib/skel/core/types.lisp --- a/lisp/lib/skel/core/types.lisp Sun Jul 07 02:14:24 2024 -0400 +++ b/lisp/lib/skel/core/types.lisp Sun Jul 07 14:50:09 2024 -0400 @@ -3,7 +3,7 @@ (deftype vc-designator () `(member :hg :git list)) ;; ref: https://spdx.org/licenses/ -(deftype license-designator () `(or string pathname (member :mpl2 :wtfpl :lgpg :llgpl :gpl :mit :mit0))) +(deftype license-designator () `(or null string pathname (member :mpl2 :wtfpl :lgpg :llgpl :gpl :mit :mit0))) (deftype script-designator () '(member :bin :sh :bash :zsh :nu :lisp :python)) diff -r d1f96f95a10c -r d8a8a13a5cce lisp/lib/skel/core/util.lisp --- a/lisp/lib/skel/core/util.lisp Sun Jul 07 02:14:24 2024 -0400 +++ b/lisp/lib/skel/core/util.lisp Sun Jul 07 14:50:09 2024 -0400 @@ -116,15 +116,15 @@ "Open the current system configuration using ED." (ed *system-skelrc*)) -(defun get-skelrc-slot* (slot) +(defun get-skelrc-slot* (slot &optional (default (skel-simple-error "slot is unbound in skel config"))) "First check *SKEL-USER-CONFIG* for a slot value, and if a valid value isn't found check *SKEL-SYSTEM-CONFIG*." (let ((slot (find-symbol (string-upcase (string slot)) :skel/core/obj))) - (if (not (slot-boundp *skel-user-config* slot)) - (if (not (slot-boundp *skel-system-config* slot)) - (skel-simple-error (format nil "slot is unbound: ~a" slot)) - (slot-value *skel-system-config* slot))) - (slot-value *skel-user-config* slot))) + (if (or (null *skel-user-config*) (not (slot-boundp *skel-user-config* slot))) + (if (or (null *skel-system-config*) (not (slot-boundp *skel-system-config* slot))) + default + (slot-value *skel-system-config* slot)) + (slot-value *skel-user-config* slot)))) (defun init-skel-vars () "Initialize the global SKEL variables: @@ -140,10 +140,15 @@ (load-skelrc) (when-let ((project (find-skelfile *default-pathname-defaults*))) (setq *skel-project* (load-skelfile project))) - (setq *skel-cache* (get-skelrc-slot* :cache) - *skel-store* (get-skelrc-slot* :store) - *skel-stash* (get-skelrc-slot* :stash) - *skel-registry* (get-skelrc-slot* :registry)) + (when-let ((cache (get-skelrc-slot* :cache nil))) + (setq *skel-cache* cache)) + + (when-let ((store (get-skelrc-slot* :store nil))) + (setq *skel-store* store)) + (when-let ((stash (get-skelrc-slot* :stash nil))) + (setq *skel-stash* stash)) + (when-let ((registry (get-skelrc-slot* :registry nil))) + (setq *skel-registry* registry)) (values)) ;;; Paths