Permalink
Browse files

Copy private print-doc from clojure.repl

  • Loading branch information...
1 parent e8db3a3 commit 5db83e6a4b81b571d828c17c4bbebe58995587c2 @stuartsierra stuartsierra committed Dec 19, 2010
Showing with 22 additions and 0 deletions.
  1. +22 −0 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]

0 comments on commit 5db83e6

Please sign in to comment.