aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/ns-utils/src/main/clojure/clojure/contrib/ns_utils.clj22
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]