From: Saba Saba Date: Thu, 9 Feb 2023 17:26:23 +0000 (-0500) Subject: Added skip-file-pattern and no-skip-file-pattern. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=c2e83e2033b1ec08c312525e19bc5dd7348d3dad;p=git-repl.git Added skip-file-pattern and no-skip-file-pattern. --- diff --git a/git-repl.cl b/git-repl.cl index e203ae4..c4b87e2 100644 --- a/git-repl.cl +++ b/git-repl.cl @@ -142,6 +142,21 @@ "Unskips every skipped file" (no-skip-file (skipped-files))) +(defun handle-skip-file-pattern (skip-action files-action pattern predicate) + (funcall skip-action (remove-if-not (lambda (file-name) (funcall predicate pattern file-name)) (funcall files-action)))) + +(defun-public skip-file-pattern (pattern &key (predicate #'str:ends-with-p)) + "Skips every file with the specified pattern in the filename. + By default, the pattern is checked only at the end of the filename. + Use STR:STARTS-WITH-P or STR:CONTAINSP for different behaviour." + (handle-skip-file-pattern #'skip-file #'modified-files pattern predicate)) + +(defun-public no-skip-file-pattern (pattern &key (predicate #'str:ends-with-p)) + "Unskips every file with the specified pattern in the filename. + By default, the pattern is checked only at the end of the filename. + Use STR:STARTS-WITH-P or STR:CONTAINSP for different behaviour." + (handle-skip-file-pattern #'no-skip-file #'skipped-files pattern predicate)) + (defun-public save-stash () "Stashes every modified file" (git "stash"))