|
@@ -5,15 +5,45 @@
|
|
"Shortcut function over :test #'equal for working with TOML alists"
|
|
"Shortcut function over :test #'equal for working with TOML alists"
|
|
(cdr (assoc key alist :test #'equal)))
|
|
(cdr (assoc key alist :test #'equal)))
|
|
|
|
|
|
|
|
+(defun find-config ()
|
|
|
|
+ (let ((config-paths (list
|
|
|
|
+ (concatenate 'string (uiop:getenv "HOME") "/.config/pest/config.toml")
|
|
|
|
+ "/etc/pest/config.toml"
|
|
|
|
+ (concatenate 'string (uiop:getenv "PWD") "./config"))))
|
|
|
|
+ (loop for path-str in config-paths
|
|
|
|
+ do (if (probe-file path-str)
|
|
|
|
+ (return-from find-config path-str)))))
|
|
|
|
+
|
|
(defun config-parse (&optional path)
|
|
(defun config-parse (&optional path)
|
|
- (let ((config-path (if path path (concatenate 'string (uiop:getenv "HOME") "/.config/pest/config.toml"))))
|
|
|
|
- (if (probe-file config-path)
|
|
|
|
|
|
+ (let ((config-path (if path path (find-config))))
|
|
|
|
+ (if config-path
|
|
(with-open-file (fh config-path :direction :input)
|
|
(with-open-file (fh config-path :direction :input)
|
|
(let ((file-content (with-output-to-string (out)
|
|
(let ((file-content (with-output-to-string (out)
|
|
(loop for line = (read-line fh nil)
|
|
(loop for line = (read-line fh nil)
|
|
while line
|
|
while line
|
|
do (format out "~a~%" line)))))
|
|
do (format out "~a~%" line)))))
|
|
- (clop:parse file-content))))))
|
|
|
|
|
|
+ (clop:parse file-content)))
|
|
|
|
+ (clop:parse "
|
|
|
|
+[git]
|
|
|
|
+display_head = false
|
|
|
|
+display_branch = false
|
|
|
|
+git_prefix = \"\"
|
|
|
|
+[git.colors]
|
|
|
|
+fg = [0, 120, 50]
|
|
|
|
+bg = [0, 0, 0]
|
|
|
|
+
|
|
|
|
+[prompt]
|
|
|
|
+display_user = false
|
|
|
|
+user_suffix = \"\"
|
|
|
|
+display_hostname = false
|
|
|
|
+hostname_suffix = \"\"
|
|
|
|
+display_pwd = true
|
|
|
|
+pwd_suffix = \"\"
|
|
|
|
+prompt_char = \" λ \"
|
|
|
|
+[prompt.colors]
|
|
|
|
+fg = [255, 255, 255]
|
|
|
|
+bg = [0, 0, 0]
|
|
|
|
+"))))
|
|
|
|
|
|
(defvar *config* NIL)
|
|
(defvar *config* NIL)
|
|
|
|
|
|
@@ -100,7 +130,7 @@
|
|
|
|
|
|
|
|
|
|
(defun reload-config ()
|
|
(defun reload-config ()
|
|
- (setf *config* (config-parse "~/Repos/cl-pest/config.toml"))
|
|
|
|
|
|
+ (setf *config* (config-parse))
|
|
(setf *prompt-style* (make-style *config* "prompt"))
|
|
(setf *prompt-style* (make-style *config* "prompt"))
|
|
(if (check-git-enabled *config*)
|
|
(if (check-git-enabled *config*)
|
|
(setf *git-style* (make-style *config* "git"))))
|
|
(setf *git-style* (make-style *config* "git"))))
|