babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-02-05T08:26:18.334700Z

@neo2551 cider-pprint now works in the babashka nrepl server from master (also see #babashka_circleci_builds). Thanks @grazfather

2021-02-05T08:26:40.335Z

Great! Thanks!

solf 2021-02-05T09:13:36.335100Z

Works great, thanks @grazfather

borkdude 2021-02-05T10:22:24.336300Z

Worked a bit on babashka.fs:

user=> (pprint (fs/read-attributes "." "*"))
{:creationTime
 #object[java.nio.file.attribute.FileTime 0x62f9c790 "1970-01-01T00:00:00Z"],
 :isSymbolicLink false,
 :isOther false,
 :lastAccessTime
 #object[java.nio.file.attribute.FileTime 0x310d57b1 "2021-02-05T09:48:12.076597Z"],
 :isRegularFile false,
 :size 608,
 :lastModifiedTime
 #object[java.nio.file.attribute.FileTime 0x52f8a6f4 "2021-02-04T10:06:30.52264Z"],
 :fileKey
 #object[sun.nio.fs.UnixFileKey 0x28b523a "(dev=1000004,ino=113467892)"],
 :isDirectory true}
So fs/attributes fetches the file attributes, coerces it into a hash-map and keywordizes the keys as keywords. I wonder if I should go the extra mile and keywordize the keys using camel-snake-kebab to :creation-time etc... not sure Since these things also go into (fs/set-attribute "file" "basic:creationTime"), might better not change it too much from the original

borkdude 2021-02-05T10:26:11.336600Z

E.g.:

user=> (-> (fs/set-attribute "/tmp/foo.clj" "basic:lastModifiedTime" (fs/millis->file-time 100)) (fs/read-attributes "*") :lastModifiedTime fs/file-time->millis)
100

borkdude 2021-02-05T10:26:45.337200Z

I think I answered my own question here, letting them stay in their original format except for string -> keyword, make sense

👍 1
grazfather 2021-02-05T15:58:24.339900Z

My pleasure 🙂

Dig 2021-02-05T16:37:15.341100Z

since you've mentioned it, is camel-snake-kebab and reverse funs somewhere in bb?

borkdude 2021-02-05T16:37:54.341500Z

@i.slack you can use it as a lib from source: https://github.com/babashka/babashka/issues/463#issuecomment-766789749

Dig 2021-02-05T16:39:18.342300Z

ah yes, just thought it is batteries included and i've missed it. thx.