Implemented a proper REPL
authorSaba Saba <saba@sabadev.xyz>
Thu, 9 Feb 2023 17:26:19 +0000 (12:26 -0500)
committerSaba Saba <saba@sabadev.xyz>
Thu, 9 Feb 2023 17:26:19 +0000 (12:26 -0500)
git-repl.cl

index 5b8ee84..daef446 100644 (file)
        ,@body
        (write-line "You have modified files. Please stash or commit your files before proceeding.")))
 
-(defvar *installation-file* "C:/bin/git-repl.exe" "The filepath to install to when running (make-install)")
-
-(defun make (executable-name)
-  "Compiles the current state into an executable"
-  (progn
-    (load (compile-file "git-repl.cl"))
-    (save-lisp-and-die executable-name :executable t)))
-
-(defun make-install ()
-  "Compiles the current state into an executable and installs it to *installation-file*"
-  (make *installation-file*))
-
 (defun add-quotes (text)
   (format nil "\"~a\"" text))
 
   (write-line "Execute (help) to see these instructions again.")
   nil)
 
-(help)
+(defun main ()
+  (progn
+    (help)
+    (loop
+      (progn
+        (format t "> ")
+        (force-output)
+        (print (eval (read)))
+        (terpri)
+        (force-output)))))
+
+(defvar *installation-file* "C:/bin/git-repl.exe" "The filepath to install to when running (make-install)")
+
+(defun make (executable-name)
+  "Compiles the current state into an executable"
+  (progn
+    (load (compile-file "git-repl.cl"))
+    (save-lisp-and-die executable-name :toplevel #'main :executable t)))
+
+(defun make-install ()
+  "Compiles the current state into an executable and installs it to *installation-file*"
+  (make *installation-file*))