Created
December 11, 2009 06:25
-
-
Save devn/254026 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns doc-ns.core | |
(:gen-class) | |
[:use clojure.contrib.duck-streams | |
compojure]) | |
(defn sort-ns | |
"Sorts the keys from the map returned by ns-publics for a given nspace into alphabetical order." | |
[nspace] | |
(sort (keys (ns-publics nspace)))) | |
(defn print-ns-docs-to-file | |
"Prints the documentation for a given nspace to a file-name which is located on path." | |
[nspace, path-to-file, file-name] | |
(with-out-writer | |
(file-str path-to-file file-name) | |
(doseq [s (sort-ns nspace)] | |
(print-doc s)))) | |
(defn -main [& args] | |
(let [nspace (quote (first args)) | |
path-to-file (second args) | |
file-name (last args)] | |
(print-ns-docs-to-file nspace path-to-file file-name))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment