diff --git a/.local/share/common-lisp/source/ambrevar/shell.lisp b/.local/share/common-lisp/source/ambrevar/shell.lisp index 58a11428..42e350c5 100644 --- a/.local/share/common-lisp/source/ambrevar/shell.lisp +++ b/.local/share/common-lisp/source/ambrevar/shell.lisp @@ -37,6 +37,16 @@ Useful for `finder'." (string= ext (pathname-type file))) (cons extension more-extensions)))) +(export-always 'match-name) +(defun match-name (name &rest more-names) + "Return a predicate that matches when one of the names is contained in the +file basename. +Basename includes the extension. Useful for `finder'." + (lambda (file) + (some (lambda (name) + (str:contains? name (file-basename file))) + (cons name more-names)))) + (export-always 'match-directory) (defun match-directory (&key (empty? t) (non-empty? t) (files? t)) "Return a predicate that matches on directories.