Преглед изворни кода

Added git display, trying to get ECL working

Simon Watson пре 1 година
родитељ
комит
5faa61e67b
5 измењених фајлова са 29 додато и 12 уклоњено
  1. 1 1
      build.lisp
  2. 5 2
      config.toml
  3. 9 6
      ecl-build.lisp
  4. 1 1
      pest.asd
  5. 13 2
      pest.lisp

+ 1 - 1
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)

+ 5 - 2
config.toml

@@ -1,3 +1,6 @@
 [colors]
-fg = [23, 200, 150]
-bg = [0, 0, 0]
+fg = [255, 255, 255]
+bg = [0, 0, 0]
+
+[git]
+display_head = false

+ 9 - 6
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))
+

+ 1 - 1
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")))

+ 13 - 2
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*))