From 7442cd8613d2743989828416f956ce52d9cf4c01 Mon Sep 17 00:00:00 2001 From: Saba Saba Date: Thu, 9 Feb 2023 12:26:17 -0500 Subject: [PATCH] Got grep/findstr working for skipped-files. --- git-skipper.cl | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/git-skipper.cl b/git-skipper.cl index e44d9f1..7556966 100644 --- a/git-skipper.cl +++ b/git-skipper.cl @@ -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") -- 2.20.1