Added 'input' as an argument to the git macro.
authorSaba Saba <saba@sabadev.xyz>
Thu, 9 Feb 2023 17:26:16 +0000 (12:26 -0500)
committerSaba Saba <saba@sabadev.xyz>
Thu, 9 Feb 2023 17:26:16 +0000 (12:26 -0500)
git-skipper.cl

index 92b9ff6..e44d9f1 100644 (file)
@@ -1,23 +1,32 @@
-(ql:quickload "cl-utilities")
+(ql:quickload '("cl-utilities" "str"))
 
 (in-package :cl-user)
 
 (defun remove-empty (seq)
-  (remove-if (cl-utilities:compose #'zerop #'length) seq))
+  (remove-if #'str:emptyp seq))
 
-(defmacro git (&rest arguments)
+(defmacro git (input &rest arguments)
   `(remove-empty
-     (mapcar (lambda (x) (string-trim " " x))
-             (cl-utilities:split-sequence #\newline (uiop:run-program (list "git" ,@arguments) :input nil :output :string)))))
+     (mapcar #'str:trim (str:lines (uiop:run-program (list "git" ,@arguments) :force-shell t :input ,input :output :string) :omit-nulls t))))
 
 (defun modified-files ()
-  (git "diff" "--name-only"))
+  (git nil "diff" "--name-only"))
 
 (defun skipped-files ()
-  (git "ls-files" "-v"))
+  (git nil "ls-files" "-v" "|" "findstr" "^S"))
 
 (defun skip-file (file-path)
-  (git "update-index" "--skip-worktree" file-path))
+  (git nil "update-index" "--skip-worktree" file-path))
 
 (defun no-skip-file (file-path)
-  (git "update-index" "--no-skip-worktree" file-path))
+  (git nil "update-index" "--no-skip-worktree" file-path))
+
+(defun status ()
+  (git nil "status"))
+
+(no-skip-file "git-skipper.cl")
+(skip-file "git-skipper.cl")
+(modified-files)
+(skipped-files)
+(status)
+(git nil "commit" "-av")