changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: config tweaks

changeset 179: e2316f0c5c63
parent 178: 3fbb8bd3409b
child 180: eb5d58851d24
author: Richard Westhaver <ellis@rwest.io>
date: Sat, 27 Jan 2024 20:13:01 -0500
files: lisp/lib/skel/core/obj.lisp
description: config tweaks
     1.1--- a/lisp/lib/skel/core/obj.lisp	Sat Jan 27 19:44:23 2024 -0500
     1.2+++ b/lisp/lib/skel/core/obj.lisp	Sat Jan 27 20:13:01 2024 -0500
     1.3@@ -24,15 +24,15 @@
     1.4 (declaim (type pathname *skel-stash* *skel-store*
     1.5 	       *skel-cache* *user-skelrc* *system-skelrc*))
     1.6 
     1.7-(defparameter *skel-stash* (pathname (format nil "/home/~a/.skel/stash/" *default-skel-user*)))
     1.8+(defparameter *skel-stash* #P"~/.skel/stash/")
     1.9 
    1.10-(defparameter *skel-store* (pathname (format nil "/home/~a/.skel/store/" *default-skel-user*)))
    1.11+(defparameter *skel-store* #P"~/.skel/store/")
    1.12 
    1.13-(defparameter *skel-cache* (pathname (format nil "/home/~a/.skel/cache/" *default-skel-user*)))
    1.14+(defparameter *skel-cache* #P"~/.skel/cache/")
    1.15 
    1.16-(defparameter *skel-registry* (pathname (format nil "/home/~a/.skel/registry/" *default-skel-user*)))
    1.17+(defparameter *skel-registry* #P"~/.skel/registry/")
    1.18 
    1.19-(defparameter *user-skelrc* (pathname (format nil "/home/~A/~A" *default-skel-user* *default-skelrc*)))
    1.20+(defparameter *user-skelrc* (pathname (format nil "~~/~A" *default-skelrc*)))
    1.21 
    1.22 (defparameter *system-skelrc* (pathname "/etc/skel/skelrc"))
    1.23 
    1.24@@ -152,19 +152,20 @@
    1.25 
    1.26 ;;;; Config
    1.27 (defclass sk-config (skel sxp) 
    1.28-  ((imports :type list)
    1.29-   (vc :type vc-designator :accessor sk-vc)
    1.30-   (shed :type pathname :accessor sk-shed)
    1.31-   (stash :type pathname :accessor sk-stash)
    1.32-   (cache :type pathname :accessor sk-cache)
    1.33-   (registry :type pathname :accessor sk-registry)
    1.34-   (scripts :type (or pathname list) :accessor sk-scripts)
    1.35-   (license :type license-designator :accessor sk-license)
    1.36-   (log-level :type log-level-designator)
    1.37-   (fmt :type symbol)
    1.38-   (alias-list :type (or list vector)
    1.39+  ((imports :initarg :imports :type list)
    1.40+   (vc :initform *default-skel-vc-kind* :initarg :vc :type vc-designator :accessor sk-vc)
    1.41+   (store :initform *skel-store* :initarg :store :type pathname :accessor sk-store)
    1.42+   (stash :initform *skel-stash* :initarg :stash :type pathname :accessor sk-stash)
    1.43+   (cache :initform *skel-cache* :initarg :cache :type pathname :accessor sk-cache)
    1.44+   (registry :initform *skel-registry* :initarg :registry :type pathname :accessor sk-registry)
    1.45+   (scripts :initarg :scripts :type (or pathname list) :accessor sk-scripts)
    1.46+   (license :initarg :license :type license-designator :accessor sk-license)
    1.47+   (log-level :initarg :log-level :type log-level-designator)
    1.48+   (fmt :initarg :fmt :type symbol)
    1.49+   (alias-list :initarg :alias-list
    1.50+               :type (or list vector)
    1.51 	       :documentation "alist of aliases. currently used as a special cli-opt-parser by the skel binary.")
    1.52-   (auto-insert :type form))
    1.53+   (auto-insert :initform nil :initarg :auto-insert :type form))
    1.54   (: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."))
    1.55 
    1.56 (defun bound-string-p (o s) (and (slot-boundp o s) (stringp (slot-value o s))))
    1.57@@ -179,7 +180,7 @@
    1.58             (when-let ((s (find-sk-symbol k)))
    1.59 	      (setf (slot-value self s) v))) ;; needs to be the correct package
    1.60 	  (when (bound-string-p self 'stash) (setf (sk-stash self) (pathname (sk-stash self))))
    1.61-	  (when (bound-string-p self 'shed) (setf (sk-shed self) (pathname (sk-shed self))))
    1.62+	  (when (bound-string-p self 'store) (setf (sk-store self) (pathname (sk-store self))))
    1.63 	  (when (bound-string-p self 'cache) (setf (sk-cache self) (pathname (sk-cache self))))
    1.64 	  (when (bound-string-p self 'registry) (setf (sk-registry self) (pathname (sk-registry self))))
    1.65 	  (when (bound-string-p self 'scripts) (setf (sk-scripts self)
    1.66@@ -196,17 +197,16 @@
    1.67   (make-instance 'sk-system-config))
    1.68 
    1.69 (defclass sk-user-config (sk-config sk-meta)
    1.70-  ((user :type form :accessor sk-user)
    1.71-   (name :type form :accessor sk-name))
    1.72+  ((user :initarg :user :type form :accessor sk-user)
    1.73+   (name :initarg :name :type form :accessor sk-name))
    1.74   (:documentation "User configuration object, typically written to ~/.skelrc."))
    1.75 
    1.76-(defun default-sk-user-config ()
    1.77-  (make-instance 'sk-system-config))
    1.78+(defun default-sk-user-config () (make-instance 'sk-user-config))
    1.79 
    1.80 (declaim (type sk-user-config *skel-user-config*))
    1.81 (declaim (type sk-system-config *skel-system-config*))
    1.82-(defvar *skel-user-config* (make-instance 'sk-user-config))
    1.83-(defvar *skel-system-config* (make-instance 'sk-system-config))
    1.84+(defvar *skel-user-config* (default-sk-user-config))
    1.85+(defvar *skel-system-config* (default-sk-system-config))
    1.86 
    1.87 ;;;; Snippet
    1.88 (defstruct sk-snippet
    1.89@@ -252,7 +252,7 @@
    1.90    (scripts :initarg :scripts :initform nil :accessor sk-scripts :type (or list (vector sk-script)))
    1.91    (snippets :initarg :snippets :initform nil :accessor sk-snippets :type (or list (vector sk-snippet)))
    1.92    (stash :initarg :stash :accessor sk-stash :type pathname)
    1.93-   (shed :initarg :shed :accessor sk-shed :type pathname)
    1.94+   (store :initarg :store :accessor sk-store :type pathname)
    1.95    (abbrevs :initarg :abbrevs :initform nil :accessor sk-abbrevs :type (or list (vector sk-abbrevs)))
    1.96    (imports :initarg :imports :initform nil :accessor sk-imports :type (or list (vector pathname)))))
    1.97 
    1.98@@ -270,7 +270,7 @@
    1.99             (when-let ((s (find-sk-symbol k)))
   1.100 	      (setf (slot-value self s) v))) ;; needs to be correct package
   1.101 	  (when (bound-string-p self 'stash) (setf (sk-stash self) (pathname (sk-stash self))))
   1.102-	  (when (bound-string-p self 'shed) (setf (sk-shed self) (pathname (sk-shed self))))
   1.103+	  (when (bound-string-p self 'store) (setf (sk-store self) (pathname (sk-store self))))
   1.104 	  (when (bound-string-p self 'scripts) (setf (sk-scripts self)
   1.105 					       ;; TODO 2023-10-14: convert into list of script names
   1.106 					       (pathname (sk-scripts self))))