Skip to content

Commit e82b700

Browse files
committed
FEAT: ? /refinement should list function refinements
implements: Oldes/Rebol-issues#1340
1 parent 257c25f commit e82b700

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/mezz/mezz-help.reb

+24-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ import module [
182182
'word [any-type!]
183183
/into "Help text will be inserted into provided string instead of printed"
184184
string [string!] "Returned series will be past the insertion"
185-
/local value spec args refs rets type ret desc arg def des ref
185+
/local value spec args refs rets type ret desc arg def des ref str
186186
][
187187
try [
188188
max-desc-width: (query/mode system/ports/input 'buffer-cols) - 35
@@ -223,6 +223,29 @@ import module [
223223
]
224224
throw true
225225
]
226+
refinement? :word [
227+
output [mold :word "is" form-type :word "used in these functions:^/^/"]
228+
str: copy ""
229+
foreach [name val] system/contexts/lib [
230+
;probe word
231+
if all [
232+
any-function? :val
233+
spec: spec-of :val
234+
desc: find/tail spec :word
235+
][
236+
str: join "^[[1;32m" form-pad name 15
237+
append str "^[[m "
238+
append str form-pad type? :val 11 - min 0 ((length? str) - 15)
239+
append str join "^[[1;32m" mold :word
240+
if string? desc/1 [
241+
append str " ^[[0;32m"
242+
append str desc/1
243+
]
244+
output ajoin [" " str "^[[m^/"]
245+
]
246+
]
247+
throw true
248+
]
226249
not any [word? :word path? :word] [
227250
output [mold :word "is" form-type :word]
228251
throw true

0 commit comments

Comments
 (0)