@@ -124,10 +124,10 @@ import module [
124
124
/weak "Provides sorting and does not displays unset values"
125
125
/match "Include only those that match a string or datatype"
126
126
pattern
127
- /only {Do not display "no info" message}
128
- /local start wild type str result
127
+ /local start wild type str result user?
129
128
] [
130
129
result: clear ""
130
+ user?: same? obj system/contexts/user
131
131
; Search for matching strings:
132
132
wild: all [string? pattern find pattern "*" ]
133
133
foreach [word val] obj [
@@ -150,6 +150,9 @@ import module [
150
150
type = :pattern
151
151
]
152
152
][
153
+ ; don't show user context values if these are same like library ones
154
+ if all [user? any [ word = 'lib-local same? val select system/contexts/lib word]][ continue ]
155
+
153
156
str: join "^[ [1;32m" form-pad word 15
154
157
append str "^[ [m "
155
158
append str form-pad type 11 - min 0 ((length? str) - 15 )
@@ -161,9 +164,7 @@ import module [
161
164
]
162
165
]
163
166
]
164
- either all [pattern empty? result not only] [
165
- ajoin ["No information on: ^[ [32m" pattern "^[ [m^/ " ]
166
- ][ copy result ]
167
+ copy result
167
168
]
168
169
169
170
out-description : func [ des [block! ]] [
@@ -179,12 +180,11 @@ import module [
179
180
'word [any-type! ]
180
181
/into "Help text will be inserted into provided string instead of printed"
181
182
string [string! ] "Returned series will be past the insertion"
182
- /local value spec args refs rets type ret desc arg def des ref str cols
183
+ /local value spec args refs rets type ret desc arg def des ref str cols tmp
183
184
] [
184
185
;@@ quering buffer width in CI under Windows now throws error: `Access error: protocol error: 6`
185
186
;@@ it should return `none` like under Posix systems!
186
- cols: try [ query /mode system/ports/input 'buffer-cols ]
187
- unless integer? cols [ cols: 120 ]
187
+ cols: any [ attempt [ query /mode system/ports/input 'buffer-cols ] 120 ]
188
188
max-desc-width: cols - 35
189
189
buffer: any [string clear "" ]
190
190
catch [
@@ -209,7 +209,20 @@ import module [
209
209
][ word: mold :word ] ;or use it as a string input
210
210
]
211
211
string? :word [
212
- output dump-obj/weak/match system/contexts/lib :word
212
+ tmp: false
213
+ case /all [
214
+ not empty? value: dump-obj/weak/match system/contexts/lib :word [
215
+ output ajoin ["Found these related matches:^/ " value]
216
+ tmp: true
217
+ ]
218
+ not empty? value: dump-obj/weak/match system/contexts/user :word [
219
+ output ajoin ["Found these related matches in the user context:^/ " value]
220
+ tmp: true
221
+ ]
222
+ not tmp [
223
+ output ajoin ["No information on: ^[ [32m" :word "^[ [m^/ " ]
224
+ ]
225
+ ]
213
226
throw true
214
227
]
215
228
datatype? :value [
@@ -226,9 +239,12 @@ import module [
226
239
"It is defined as" either find "aeiou" first spec/title [" an " ] [" a " ] spec/title ".^/ "
227
240
"It is of the general type ^[ [1;32m" spec/type "^[ [m.^/^/ "
228
241
]
229
- unless empty? value: dump-obj/match/only system/contexts/lib :word [
242
+ unless empty? value: dump-obj/match system/contexts/lib :word [
230
243
output ajoin ["Found these related words:^/ " value]
231
244
]
245
+ unless empty? value: dump-obj/match system/contexts/user :word [
246
+ output ajoin ["Found these related words in the user context:^/ " value]
247
+ ]
232
248
]
233
249
throw true
234
250
]
0 commit comments