Merge pull request #2135 from dryewo/master

Add support for get-in pprinting to lein-pprint
This commit is contained in:
Jean Niklas L'orange 2016-04-28 09:59:13 +02:00
commit 66c7f9a8ea
2 changed files with 12 additions and 2 deletions

View file

@ -5,7 +5,10 @@
"Pretty-print a representation of the project map."
[project & keys]
(if (seq keys)
(doseq [k keys]
(pprint/pprint (project (read-string k))))
(doseq [kstr keys]
(let [k (read-string kstr)]
(pprint/pprint (if (sequential? k)
(get-in project k)
(get project k)))))
(pprint/pprint project))
(flush))

View file

@ -0,0 +1,7 @@
(ns leiningen.pprint-test
(:require [clojure.test :refer :all]
[leiningen.pprint :refer :all]))
(deftest can-pprint
(is (= "1\n" (with-out-str (pprint {:foo 1} ":foo"))))
(is (= "1\n" (with-out-str (pprint {:foo {:bar 1}} "[:foo :bar]")))))