Created
February 8, 2015 04:06
-
-
Save edma2/787ffb173a815a089210 to your computer and use it in GitHub Desktop.
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 lein exec | |
;; formats Clojure code from stdin, and prints formatted code to stdout | |
(require 'leiningen.exec) | |
;; Add a dependency to the classpath on the fly | |
(leiningen.exec/deps '[[cljfmt "0.1.7"]]) | |
(require '[cljfmt.core :as cljfmt]) | |
(defn- stdin-lines [] | |
(line-seq (java.io.BufferedReader. *in*))) | |
(defn- stdin-string [] | |
(clojure.string/join "\n" (stdin-lines))) | |
(println (cljfmt/reformat-string (stdin-string))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment