Got grep/findstr working for skipped-files.
authorSaba Saba <saba@sabadev.xyz>
Thu, 9 Feb 2023 17:26:17 +0000 (12:26 -0500)
committerSaba Saba <saba@sabadev.xyz>
Thu, 9 Feb 2023 17:26:17 +0000 (12:26 -0500)
git-skipper.cl

index e44d9f1..7556966 100644 (file)
@@ -2,31 +2,37 @@
 
 (in-package :cl-user)
 
-(defun remove-empty (seq)
-  (remove-if #'str:emptyp seq))
+(defvar *grep* "findstr")
 
-(defmacro git (input &rest arguments)
-  `(remove-empty
-     (mapcar #'str:trim (str:lines (uiop:run-program (list "git" ,@arguments) :force-shell t :input ,input :output :string) :omit-nulls t))))
+(defun remove-empty (text)
+  (remove-if #'str:emptyp text))
+
+(defun run-command (command)
+  (remove-empty
+    (mapcar #'str:trim
+            (str:lines
+              (uiop:run-program command :ignore-error-status t :force-shell t :input nil :output :string)
+              :omit-nulls t))))
+
+(defun git (&rest arguments)
+  (run-command (str:join " " (cons "git" arguments))))
 
 (defun modified-files ()
-  (git nil "diff" "--name-only"))
+  (git "diff" "--name-only"))
 
 (defun skipped-files ()
-  (git nil "ls-files" "-v" "|" "findstr" "^S"))
+  (git "ls-files" "-v" "|" *grep* "^S"))
 
 (defun skip-file (file-path)
-  (git nil "update-index" "--skip-worktree" file-path))
+  (git "update-index" "--skip-worktree" file-path))
 
 (defun no-skip-file (file-path)
-  (git nil "update-index" "--no-skip-worktree" file-path))
+  (git "update-index" "--no-skip-worktree" file-path))
 
 (defun status ()
-  (git nil "status"))
+  (git "status"))
 
 (no-skip-file "git-skipper.cl")
 (skip-file "git-skipper.cl")
 (modified-files)
 (skipped-files)
-(status)
-(git nil "commit" "-av")