Last active
July 3, 2020 09:02
-
-
Save jeroenvandijk/901db90caa7854b36a80061fa7989655 to your computer and use it in GitHub Desktop.
Babashka script for sorting clojure code lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Idea from https://gist.github.com/plexus/4e8eb797005162faed5bce06e31ebf6d