@@ -15,7 +15,7 @@ import module [
15
15
Title: "Help related functions"
16
16
Name: Help
17
17
Version: 3.0.0
18
- Exports: [? help about usage what license source]
18
+ Exports: [? help about usage what license source dump-obj ]
19
19
][
20
20
buffer: none
21
21
max-desc-width: 45
@@ -119,15 +119,15 @@ import module [
119
119
val
120
120
]
121
121
122
- out-form -obj : func [
123
- "Returns a block of information about an object or port "
122
+ dump -obj : func [
123
+ "Returns a string with information about an object value "
124
124
obj [any-object! ]
125
125
/weak "Provides sorting and does not displays unset values"
126
126
/match "Include only those that match a string or datatype"
127
127
pattern
128
- /local start wild type str
128
+ /local start wild type str result
129
129
] [
130
- start: buffer
130
+ result: make string! 250
131
131
; Search for matching strings:
132
132
wild: all [string? pattern find pattern "*" ]
133
133
foreach [word val] obj [
@@ -156,14 +156,13 @@ import module [
156
156
str: join "^[ [1;32m" form-pad word 15
157
157
append str "^[ [m "
158
158
append str form-pad type 11 - min 0 ((length? str) - 15 )
159
- output [" " str "^[ [32m" form-val :val "^[ [m^/ " ]
159
+ append result ajoin [" " str "^[ [32m" form-val :val "^[ [m^/ " ]
160
160
]
161
161
]
162
162
]
163
- if all [pattern buffer = start] [
164
- buffer: insert buffer reduce ["No information on: ^[ [32m" pattern "^[ [m^/ " ]
165
- ]
166
- buffer
163
+ either all [pattern empty? result] [
164
+ ajoin ["No information on: ^[ [32m" pattern "^[ [m^/ " ]
165
+ ][ result ]
167
166
]
168
167
169
168
out-description : func [ des [block! ]] [
@@ -198,12 +197,12 @@ import module [
198
197
][ word: mold :word ] ;or use it as a string input
199
198
]
200
199
string? :word [
201
- out-form -obj/weak/match system/contexts/lib :word
200
+ output dump -obj/weak/match system/contexts/lib :word
202
201
throw true
203
202
]
204
203
datatype? :value [
205
204
output ajoin ["^[ [1;32m" uppercase mold :word "^[ [m is a datatype of value: ^[ [32m" mold :value "^[ [m^/ " ]
206
- out-form -obj/match system/contexts/lib :word
205
+ output dump -obj/match system/contexts/lib :word
207
206
throw true
208
207
]
209
208
not any [word? :word path? :word ] [
@@ -298,7 +297,7 @@ import module [
298
297
]
299
298
'else [
300
299
output ajoin ["^[ [1;32m" uppercase mold word "^[ [m is " form-type :value " of value: ^[ [32m" ]
301
- either any [any-object? value] [output lf out-form- obj :value ] [output mold :value ]
300
+ output either any [any-object? value] [dump- obj :value ][ mold :value ]
302
301
output "^[ [m"
303
302
]
304
303
]
0 commit comments