cl-grep

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 17881397605375cf6f646a294d22706f922148a6
parent cf7577eb6086d6736e0d325fe24615def1bd6dfa
Author: ChanderG <[email protected]>
Date:   Thu, 27 Nov 2025 14:36:06 +0530

add checks to directory walk to skip dirs/files

based on a hardcoded static list based on file names

Diffstat:
Mgrep.asd | 3++-
Mgrep.lisp | 15++++++++++++++-
Mpackage.lisp | 3++-
3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/grep.asd b/grep.asd @@ -4,7 +4,8 @@ :components ((:file "package") (:file "grep")) :depends-on (:uiop - :filesystem-utils) + :filesystem-utils + :pathname-utils) :build-operation "program-op" :build-pathname "cl-grep" :entry-point "cl-grep:main") diff --git a/grep.lisp b/grep.lisp @@ -1,10 +1,23 @@ (in-package cl-grep) (defun queue-file (file) - (format t "Visiting file: ~a~%" file)) + (format t "Visiting file: ~a~%" file) + (let* ((name (pu:file-name file)) + (blacklist (list #\~ #\#)) + (lc (char name (- (length name) 1)))) + (when (member lc blacklist) + (format t "Skipping ignorable file: ~a~%" file) + (return-from queue-file nil)))) + ;; do the actual thing here (defun fs-walker (dir) (format t "Visiting dir: ~a~%" dir) + ;; check if we should visit this dir + (let ((dirname (pu:directory-name dir)) + (blacklist (list ".git" ".venv"))) + (when (member dirname blacklist :test #'equalp) + (format t "Skipping dir: ~a~%" dir) + (return-from fs-walker nil))) ;; process files in this dir (fsu:map-directory #'queue-file dir :type ':file) diff --git a/package.lisp b/package.lisp @@ -1,4 +1,5 @@ (defpackage cl-grep (:use :cl) - (:local-nicknames (:fsu :org.shirakumo.filesystem-utils)) + (:local-nicknames (:fsu :org.shirakumo.filesystem-utils) + (:pu :org.shirakumo.pathname-utils)) (:export #:main))