Skip to content

Commit 117e160

Browse files
committed
CHANGE: limit output of help to single line if used with some value types
1 parent aaa70ec commit 117e160

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/mezz/mezz-help.reb

+14-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import module [
1818
Exports: [? help about usage what license source dump-obj]
1919
][
2020
buffer: none
21+
cols: 80 ; default terminal width
2122
max-desc-width: 45
2223

2324
help-text: {
@@ -186,10 +187,11 @@ import module [
186187
'word [any-type!]
187188
/into "Help text will be inserted into provided string instead of printed"
188189
string [string!] "Returned series will be past the insertion"
189-
/local value spec args refs rets type ret desc arg def des ref str
190+
/local value spec args refs rets type ret desc arg def des ref str cols
190191
][
191192
try [
192-
max-desc-width: (query/mode system/ports/input 'buffer-cols) - 35
193+
cols: query/mode system/ports/input 'buffer-cols
194+
max-desc-width: cols - 35
193195
]
194196
buffer: any [string clear ""]
195197
catch [
@@ -260,7 +262,7 @@ import module [
260262
throw true
261263
]
262264
not any [word? :word path? :word] [
263-
output [mold :word "is" form-type :word]
265+
output ajoin ["^[[1;32m" uppercase mold :word "^[[m is " form-type :word]
264266
throw true
265267
]
266268
path? :word [
@@ -369,8 +371,15 @@ import module [
369371
throw true
370372
]
371373
'else [
372-
output ajoin ["^[[1;32m" uppercase mold word "^[[m is " form-type :value " of value: ^[[32m"]
373-
output either any [any-object? value] [output lf dump-obj :value][mold :value]
374+
word: uppercase mold word
375+
type: form-type :value
376+
output ajoin ["^[[1;32m" word "^[[m is " type " of value: ^[[32m"]
377+
output either any [any-object? value] [
378+
output lf dump-obj :value
379+
][
380+
max-desc-width: cols - (length? word) - (length? type) - 21
381+
form-val :value
382+
]
374383
output "^[[m"
375384
]
376385
]

0 commit comments

Comments
 (0)