Fork me on GitHub
#babashka
<
2021-01-30
>
borkdude13:01:47

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 ""
                         :sha "74d39a8e380480c558de547cd174435d63ca121d"}}})
(require '[babashka.fs :as fs])
(fs/glob "." "**.clj") 

borkdude13:01:38

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

jkrasnay14:01:36

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!

👍 4
borkdude16:01:56

In 99eed8c041b590870d9aec6f4a717a46b0c65715 I now made some improvements. The returned paths will be relative to the input path, if the input path was also relative