babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-01-30T13:35:47.204200Z

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") 

borkdude 2021-01-30T13:37:38.205100Z

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

2021-01-30T14:05:36.207400Z

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!

👍 2
borkdude 2021-01-30T16:27:56.208100Z

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

borkdude 2021-01-30T16:30:10.208500Z

Here are some work-in-progress docs: https://babashka.org/fs/babashka.fs.html