Skip to content

Commit

Permalink
FEAT: improved help function also displays the module's specifica…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Oldes committed Apr 26, 2024
1 parent 1d4825d commit d17b0cd
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/mezz/mezz-help.reb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ REBOL [
Title: "REBOL 3 Mezzanine: Help"
Rights: {
Copyright 2012 REBOL Technologies
Copyright 2012-2022 Rebol Open Source Contributors
Copyright 2012-2024 Rebol Open Source Contributors
REBOL is a trademark of REBOL Technologies
}
License: {
Expand All @@ -15,7 +15,7 @@ REBOL [
import (module [
Title: "Help related functions"
Name: help
Version: 3.0.0
Version: 3.0.1
Exports: [? help about usage what license source dump-obj]
][
buffer: none
Expand Down Expand Up @@ -130,6 +130,7 @@ import (module [
/weak "Provides sorting and does not displays unset values"
/match "Include only those that match a string or datatype"
pattern
/not-none "Ignore NONE values"
/local start wild type str result user?
][
result: clear ""
Expand All @@ -138,7 +139,10 @@ import (module [
wild: all [string? pattern find pattern "*"]
foreach [word val] obj [
type: type?/word :val
if all [weak type = 'unset!][ continue ]
if any [
all [weak type = 'unset!]
all [not-none type = 'none!]
][ continue ]
str: either find [function! closure! native! action! op! object!] type [
reform [word mold spec-of :val words-of :val]
][
Expand Down Expand Up @@ -392,6 +396,16 @@ import (module [
output newline
throw true
]
module? :value [
output ajoin [
"^[[1;32m" uppercase mold :word "^[[m is " a-an "module with:^/"
"^[[4;1;36mSPEC^[[m:^/"
dump-obj/not-none spec-of :value
"^/^[[4;1;36mBODY^[[m:^/"
dump-obj :value
]
throw true
]
'else [
word: uppercase mold word
type: form-type :value
Expand Down

0 comments on commit d17b0cd

Please sign in to comment.