Skip to content

Instantly share code, notes, and snippets.

@jeroenvandijk
Last active July 3, 2020 09:02
Show Gist options
  • Save jeroenvandijk/901db90caa7854b36a80061fa7989655 to your computer and use it in GitHub Desktop.
Save jeroenvandijk/901db90caa7854b36a80061fa7989655 to your computer and use it in GitHub Desktop.
Babashka script for sorting clojure code lines
#!/usr/bin/env bb
(doseq [line (->> (file-seq (clojure.java.io/file (System/getenv "PWD")))
(filter #(.isFile %))
(filter (fn [f] (contains? #{"clj" "cljc" "cljs" "bb"}
(last (clojure.string/split (.getName f) #"\.")))))
(mapcat #(clojure.string/split-lines (slurp %)))
sort
)]
(println line))
@jeroenvandijk
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment