commit 5faa61e67b7c85fe9f7a4438f2bad51fe2e83d1b
Author: Simon Watson <spesk@pm.me>
Date: Sun Aug 13 10:36:06 2023 -0400
Added git display, trying to get ECL working
diff --git a/build.lisp b/build.lisp
index bc590ef..7c67c0f 100644
--- a/build.lisp
+++ b/build.lisp
@@ -2,6 +2,6 @@
(asdf:load-system 'pest)
(sb-ext:save-lisp-and-die
"pest"
- :compression T
+ :compression NIL
:toplevel 'main
:executable T)
diff --git a/config.toml b/config.toml
index 02c120c..9e1fcb1 100644
--- a/config.toml
+++ b/config.toml
@@ -1,3 +1,6 @@
[colors]
-fg = [23, 200, 150]
-bg = [0, 0, 0]
\ No newline at end of file
+fg = [255, 255, 255]
+bg = [0, 0, 0]
+
+[git]
+display_head = false
\ No newline at end of file
diff --git a/ecl-build.lisp b/ecl-build.lisp
index 4166dd9..2bdf35d 100644
--- a/ecl-build.lisp
+++ b/ecl-build.lisp
@@ -1,9 +1,12 @@
;; TODO
-
+(load "~/quicklisp/setup.lisp")
+(require 'asdf)
(load "./pest.asd")
(asdf:load-system 'pest)
-(sb-ext:save-lisp-and-die
- "pest"
- :compression T
- :toplevel 'main
- :executable T)
+(asdf:make-build :pest
+ :type :program
+ :monolithic T
+ :move-here #P"./ecl-build"
+ :prologue-code '(require :ecl-quicklisp)
+ :epilogue-code '(main))
+
diff --git a/pest.asd b/pest.asd
index 8cc5a8c..e56ce0d 100644
--- a/pest.asd
+++ b/pest.asd
@@ -2,5 +2,5 @@
:version "0.0.1"
:author "Simon Watson <swatson@casanacare.com>"
:license "GPL"
- :depends-on ("uiop" "cl-ppcre" "chlorophyll" "clop")
+ :depends-on ("legit" "uiop" "cl-ppcre" "chlorophyll" "clop")
:components ((:file "pest")))
diff --git a/pest.lisp b/pest.lisp
index 10b96dd..bbcde03 100644
--- a/pest.lisp
+++ b/pest.lisp
@@ -21,6 +21,15 @@
;; Battery
(defvar *display-battery* NIL)
+;; Git
+(defvar *display-git* NIL)
+(defvar *git-string* NIL)
+
+(defun display-git-info ()
+ (if (probe-file (pathname (concatenate 'string (uiop:getenv "PWD") "/.git")))
+ ;; (legit:git-rev-parse "HEAD" :short T)))
+ (concatenate 'string (legit:current-branch ".") "|" (legit:current-commit "." :short T))))
+
(defun reload-config ()
(setf *config* (config-parse "~/Repos/cl-pest/config.toml"))
(setf *fg* (if *config*
@@ -36,7 +45,9 @@
(setf *style* (chlorophyll:new-style
:bold NIL
:foreground *fg*
- :background *bg*)))
+ :background *bg*))
+ (setf *git-string* (if (cdr (assoc "display_head" (cdr (assoc "git" *config* :test #'equal)) :test #'equal))
+ (setf *git-string* (display-git-info)))))
;; Regex Scanners
;; TODO $HOME rendered as /home/user as opposed to ~
@@ -47,4 +58,4 @@
(defun main ()
(reload-config)
- (format T "~a λ " (chlorophyll:stylize *style* (pwd))))
+ (format T "~a ~a λ " (chlorophyll:stylize *style* (pwd)) *git-string*))