diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2010-12-19 10:59:37 -0500 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2010-12-19 10:59:37 -0500 |
commit | 5db83e6a4b81b571d828c17c4bbebe58995587c2 (patch) | |
tree | bd7b2a22d974078e490b9966669510d153c8c5b2 | |
parent | e8db3a36b1154167261aed5e07cda6c5c12b6c0e (diff) |
Copy private print-doc from clojure.repl
-rw-r--r-- | modules/ns-utils/src/main/clojure/clojure/contrib/ns_utils.clj | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/ns-utils/src/main/clojure/clojure/contrib/ns_utils.clj b/modules/ns-utils/src/main/clojure/clojure/contrib/ns_utils.clj index 592d7ccc..333a67d2 100644 --- a/modules/ns-utils/src/main/clojure/clojure/contrib/ns_utils.clj +++ b/modules/ns-utils/src/main/clojure/clojure/contrib/ns_utils.clj @@ -67,6 +67,28 @@ (doseq [item (ns-vars ns)] (println item))) +(defn- print-doc [m] + (println "-------------------------") + (println (str (when-let [ns (:ns m)] (str (ns-name ns) "/")) (:name m))) + (cond + (:forms m) (doseq [f (:forms m)] + (print " ") + (prn f)) + (:arglists m) (prn (:arglists m))) + (if (:special-form m) + (do + (println "Special Form") + (println " " (:doc m)) + (if (contains? m :url) + (when (:url m) + (println (str "\n Please see http://clojure.org/" (:url m)))) + (println (str "\n Please see http://clojure.org/special_forms#" + (:name m))))) + (do + (when (:macro m) + (println "Macro")) + (println " " (:doc m))))) + (defn print-docs "Prints documentation for the public vars in a namespace" [ns] |