fix bugs in stream arg collection - NAT
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
(unless maxLength (set maxLength Math.POSITIVE_INFINITY))
|
(unless maxLength (set maxLength Math.POSITIVE_INFINITY))
|
||||||
(stream.dropWhitespace)
|
(stream.dropWhitespace)
|
||||||
(localFunction :Void trySubmit [text]
|
(localFunction :Void trySubmit [text]
|
||||||
|
(stream.dropWhitespace)
|
||||||
(if !(<= text.length maxLength)
|
(if !(<= text.length maxLength)
|
||||||
(ui.reportError "The requested command expected a string up to $maxLength characters long. You entered: $text.length characters")
|
(ui.reportError "The requested command expected a string up to $maxLength characters long. You entered: $text.length characters")
|
||||||
(continuation text)))
|
(continuation text)))
|
||||||
@@ -29,9 +30,11 @@
|
|||||||
(trySubmit (readString stream))))
|
(trySubmit (readString stream))))
|
||||||
((VarText maxLength)
|
((VarText maxLength)
|
||||||
(unless maxLength (set maxLength Math.POSITIVE_INFINITY))
|
(unless maxLength (set maxLength Math.POSITIVE_INFINITY))
|
||||||
|
(stream.dropWhitespace)
|
||||||
(let [collectedText []]
|
(let [collectedText []]
|
||||||
(localFunction :Void enterTextAgain []
|
(localFunction :Void enterTextAgain []
|
||||||
(localFunction :Void trySubmit [text]
|
(localFunction :Void trySubmit [text]
|
||||||
|
(stream.dropWhitespace)
|
||||||
(if !text
|
(if !text
|
||||||
(continuation collectedText)
|
(continuation collectedText)
|
||||||
(if !(<= text.length maxLength)
|
(if !(<= text.length maxLength)
|
||||||
@@ -50,12 +53,14 @@
|
|||||||
((Number min max inStepsOf)
|
((Number min max inStepsOf)
|
||||||
(unless min (set min Math.NEGATIVE_INFINITY))
|
(unless min (set min Math.NEGATIVE_INFINITY))
|
||||||
(unless max (set max Math.POSITIVE_INFINITY))
|
(unless max (set max Math.POSITIVE_INFINITY))
|
||||||
|
(stream.dropWhitespace)
|
||||||
(let [&mut prompt "${arg.name} (${min}-${max}"]
|
(let [&mut prompt "${arg.name} (${min}-${max}"]
|
||||||
(when inStepsOf
|
(when inStepsOf
|
||||||
(+= prompt " in steps of ${inStepsOf}"))
|
(+= prompt " in steps of ${inStepsOf}"))
|
||||||
(+= prompt "):")
|
(+= prompt "):")
|
||||||
|
|
||||||
(localFunction :Void trySubmit [number]
|
(localFunction :Void trySubmit [number]
|
||||||
|
(stream.dropWhitespace)
|
||||||
(let [minMaxError
|
(let [minMaxError
|
||||||
"The requested command expected a number between $min and $max"
|
"The requested command expected a number between $min and $max"
|
||||||
stepError
|
stepError
|
||||||
|
Reference in New Issue
Block a user