File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ clojure -Sdeps '{:deps {org.clojure/clojure.java.doc {:git/url "https://github.c
3838
3939## Usage
4040
41- The core namespace provides two functions:
41+ The core namespace provides three functions:
4242
4343### jdoc
4444
@@ -60,6 +60,23 @@ Prints a markdown formatted version of the javadoc description:
6060(jdoc ^[_ int] String/.substring)
6161```
6262
63+ ### sigs
64+
65+ Prints the method signatures in param tags form:
66+
67+ ``` clojure
68+ (sigs String/valueOf)
69+ ; ; => ^[boolean] String/valueOf
70+ ; ; ^[char] String/valueOf
71+ ; ; ^[char/1] String/valueOf
72+ ; ; ^[char/1 int int] String/valueOf
73+ ; ; ^[double] String/valueOf
74+ ; ; ^[float] String/valueOf
75+ ; ; ^[int] String/valueOf
76+ ; ; ^[long] String/valueOf
77+ ; ; ^[Object] String/valueOf
78+ ```
79+
6380### jdoc-data
6481
6582Returns structured data instead of printing:
Original file line number Diff line number Diff line change 11(ns clojure.java.doc.api
22 (:require
3- [clojure.java.doc.impl :refer [parse-javadoc print-javadoc]]))
3+ [clojure.java.doc.impl :refer [parse-javadoc print-javadoc print-signatures ]]))
44
55(defn javadoc-data-fn [s param-tags]
66 (parse-javadoc s param-tags))
2525 (jdoc ^[char/1] String/valueOf) ; Print specific overload"
2626 [class-or-method]
2727 `(javadoc-fn ~(str class-or-method) '~(:param-tags (meta class-or-method))))
28+
29+ (defn sigs-fn [s param-tags]
30+ (print-signatures (javadoc-data-fn s param-tags)))
31+
32+ (defmacro sigs
33+ " print method signatures in param tags form"
34+ [class-or-method]
35+ `(sigs-fn ~(str class-or-method) '~(:param-tags (meta class-or-method))))
Original file line number Diff line number Diff line change 160160 (doseq [{:keys [method-description-md]} selected-method]
161161 (println (condense-lines method-description-md)))
162162 (println (condense-lines class-description-md)))))
163+
164+ (defn print-signatures [{:keys [methods selected-method]}]
165+ (let [methods-to-print (or selected-method methods)]
166+ (doseq [{:keys [clojure-call]} methods-to-print]
167+ (println clojure-call))))
You can’t perform that action at this time.
0 commit comments