From d9ed993e946cc39520d5d1a1e7481f545d9e9229 Mon Sep 17 00:00:00 2001 From: Saba Saba Date: Thu, 9 Feb 2023 12:26:16 -0500 Subject: [PATCH] Added 'input' as an argument to the git macro. --- git-skipper.cl | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/git-skipper.cl b/git-skipper.cl index 92b9ff6..e44d9f1 100644 --- a/git-skipper.cl +++ b/git-skipper.cl @@ -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") -- 2.20.1