Skip to content

Instantly share code, notes, and snippets.

@devn
Created December 11, 2009 05:58
Show Gist options
  • Save devn/254019 to your computer and use it in GitHub Desktop.
Save devn/254019 to your computer and use it in GitHub Desktop.
(ns doc-ns
(: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