Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Nicer formatting for `lein deps :tree` #492

merged 1 commit into from

2 participants


This patch adds nicer formatting to lein deps :tree. You can see example output in the README of my project: lein-deps-tree.

There's one issue: The function utilizes non-tail recursion for output. This shouldn't be a problem, except for projects with very deeply nested dependency graphs.

This code is also affected by #491 as it re-uses the same code for acquiring the dependency graph.

@technomancy technomancy merged commit ca0741a into technomancy:master

This is great; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 2, 2012
  1. @the-kenny
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/leiningen/deps.clj
13 src/leiningen/deps.clj
@@ -3,6 +3,16 @@
(:require [leiningen.core.classpath :as classpath]
[clojure.pprint :as pp]))
+;;; TODO: Get rid of this recursion
+(defn- print-tree
+ ([tree level increment]
+ (doseq [[n c] tree]
+ (println (str (apply str (repeat level \space))) n)
+ (when c
+ (print-tree c (+ level increment) increment))))
+ ([tree increment]
+ (print-tree tree 0 increment)))
(defn deps
"Download all dependencies.
@@ -11,6 +21,5 @@ You should never need to invoke this manually."
(deps project nil))
([project tree]
(if (= tree ":tree")
- (do (pp/pprint (classpath/dependency-hierarchy :dependencies project))
- (flush))
+ (print-tree (classpath/dependency-hierarchy :dependencies project) 4)
(classpath/resolve-dependencies :dependencies project))))
Something went wrong with that request. Please try again.