adding VarText and removing text minimum length

This commit is contained in:
2021-06-27 22:24:53 -06:00
parent dff01d03c8
commit c6419fb216
4 changed files with 32 additions and 12 deletions

View File

@@ -13,17 +13,35 @@
(if !(<= min selectedEntries.length max)
(ui.reportError "The requested command expects between $min and $max entries to be selected. You have selected: $selectedEntries.length")
(continuation selectedEntries)))
((Text minLength maxLength)
(unless minLength (set minLength 0))
((Text maxLength)
(unless maxLength (set maxLength Math.POSITIVE_INFINITY))
(ui.enterText
"${arg.name} (${minLength}-${maxLength} characters):"
"${arg.name} (up to ${maxLength} characters):"
(lambda :Void [text]
(if !(<= minLength text.length maxLength)
(ui.reportError "The requested command expected a string between $minLength and $maxLength characters long. You entered: $text.length characters")
(if !(<= text.length maxLength)
(ui.reportError "The requested command expected a string up to $maxLength characters long. You entered: $text.length characters")
(continuation text)))
minLength
maxLength))
((VarText maxLength)
(unless maxLength (set maxLength Math.POSITIVE_INFINITY))
(let [collectedText
[]
&mut :Void->Void enterTextAgain
null
_enterTextAgain
->:Void
(ui.enterText
"${arg.name} (up to ${maxLength} characters):"
(lambda :Void [text]
(if !text
(continuation collectedText)
(if !(<= text.length maxLength)
(ui.reportError "The requested command expected a list of strings up to $maxLength characters long. You entered: $text.length characters")
{(collectedText.push text)
(enterTextAgain)})))
maxLength)]
(set enterTextAgain _enterTextAgain)
(enterTextAgain)))
((Number min max inStepsOf)
(unless min (set min Math.NEGATIVE_INFINITY))
(unless max (set max Math.POSITIVE_INFINITY))
@@ -100,7 +118,8 @@
(exprCase type
((exprOr SelectedEntry OneEntry) `:nat.Entry ,name)
((exprOr (SelectedEntries _ _) (Entries _ _)) `:Array<nat.Entry> ,name)
((Text _ _) `:String ,name)
((Text _) `:String ,name)
((VarText _) `:Array<String> ,name)
((Number _ _ _) `:Float ,name)))
commandArgs
(for [name type] argPairs