diff --git a/lein-pprint/src/leiningen/pprint.clj b/lein-pprint/src/leiningen/pprint.clj index 176eb77a..a05e5438 100644 --- a/lein-pprint/src/leiningen/pprint.clj +++ b/lein-pprint/src/leiningen/pprint.clj @@ -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)) diff --git a/lein-pprint/test/leiningen/pprint_test.clj b/lein-pprint/test/leiningen/pprint_test.clj new file mode 100644 index 00000000..81f002bc --- /dev/null +++ b/lein-pprint/test/leiningen/pprint_test.clj @@ -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]")))))