Add support for get-in pprinting
This commit is contained in:
parent
e4d3c1e56c
commit
c63301a564
2 changed files with 12 additions and 2 deletions
|
@ -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))
|
||||
|
|
7
lein-pprint/test/leiningen/pprint_test.clj
Normal file
7
lein-pprint/test/leiningen/pprint_test.clj
Normal 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]")))))
|
Loading…
Reference in a new issue