application/octet-stream
•
840 B
•
25 lines
#!/usr/bin/env nujel
[def directories '["binlib" "stdlib" "tests" "tools"]]
[def output-file "web/filesystem.json"]
[defun directory/read-relative [path]
[map [directory/read path]
[\ [α] [cat path "/" α]]]]
[defun directory/read-recursive [path]
[flatten [map [directory/read-relative path]
[\ [A] [if [file/dir? A]
[directory/read-recursive A]
A]]]]]
[-> directories
[map directory/read-recursive]
[flatten]
[filter [path/ext?! "nuj"]]
[reduce [λ [a b] [tree/set! a
[string->keyword b]
@[name: b content: [file/read b]]]]]
[val->json]
[file/write output-file]]
[println [cat [ref ansi-bg 2] "[JSON]" ansi-bg-reset " " output-file]]