From: Saba Saba Date: Thu, 9 Feb 2023 17:26:17 +0000 (-0500) Subject: Got grep/findstr working for skipped-files. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=7442cd8613d2743989828416f956ce52d9cf4c01;p=git-repl.git Got grep/findstr working for skipped-files. --- 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")