Working on the babashka.fs lib. The hardest function is glob
and I would appreciate some of your testing.
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {babashka/fs
{:git/url "<https://github.com/babashka/fs>"
:sha "74d39a8e380480c558de547cd174435d63ca121d"}}})
(require '[babashka.fs :as fs])
(fs/glob "." "**.clj")
The rules of the glob patterns are explained in
https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)
Tl;dr: to cross dir boundaries use **
, e.g. **.clj
will match all .clj files in all dirs, *.clj
only matches .clj files in the current dir
Ran it through some tests and it seems to work fine. TIL that **
replaces any part of the path, not just a recursive set of directory names, e.g.`**ar/baz` finds foo/bar/baz
. Neat!
In 99eed8c041b590870d9aec6f4a717a46b0c65715
I now made some improvements. The returned paths will be relative to the input path, if the input path was also relative
Here are some work-in-progress docs: https://babashka.org/fs/babashka.fs.html