Adjust /while to fit new optional args
| @@ -1342,18 +1342,19 @@ export function registerVariableCommands() { | |||
| 1342 | typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER], | 1342 | typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER], |
| 1343 | isRequired: true, | 1343 | isRequired: true, |
| 1344 | enumProvider: commonEnumProviders.variables('all'), | 1344 | enumProvider: commonEnumProviders.variables('all'), |
| 1345 | forceEnum: false, | ||
| 1346 | }), | 1345 | }), |
| 1347 | SlashCommandNamedArgument.fromProps({ | 1346 | SlashCommandNamedArgument.fromProps({ |
| 1348 | name: 'right', | 1347 | name: 'right', |
| 1349 | description: 'right operand', | 1348 | description: 'right operand', |
| 1350 | typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER], | 1349 | typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.NUMBER], |
| 1351 | isRequired: true, | ||
| 1352 | enumProvider: commonEnumProviders.variables('all'), | 1350 | enumProvider: commonEnumProviders.variables('all'), |
| 1353 | forceEnum: false, | ||
| 1354 | }), | 1351 | }), |
| 1355 | new SlashCommandNamedArgument( | 1352 | SlashCommandNamedArgument.fromProps({ |
| 1356 | 'rule', 'comparison rule', [ARGUMENT_TYPE.STRING], true, false, null, [ | 1353 | name: 'rule', |
| 1354 | description: 'comparison rule', | ||
| 1355 | typeList: [ARGUMENT_TYPE.STRING], | ||
| 1356 | defaultValue: 'eq', | ||
| 1357 | enumList: [ | ||
| 1357 | new SlashCommandEnumValue('gt', 'a > b'), | 1358 | new SlashCommandEnumValue('gt', 'a > b'), |
| 1358 | new SlashCommandEnumValue('gte', 'a >= b'), | 1359 | new SlashCommandEnumValue('gte', 'a >= b'), |
| 1359 | new SlashCommandEnumValue('lt', 'a < b'), | 1360 | new SlashCommandEnumValue('lt', 'a < b'), |
| @@ -1364,10 +1365,15 @@ export function registerVariableCommands() { | |||
| 1364 | new SlashCommandEnumValue('in', 'a includes b'), | 1365 | new SlashCommandEnumValue('in', 'a includes b'), |
| 1365 | new SlashCommandEnumValue('nin', 'a not includes b'), | 1366 | new SlashCommandEnumValue('nin', 'a not includes b'), |
| 1366 | ], | 1367 | ], |
| 1367 | ), | 1368 | forceEnum: true, |
| 1368 | new SlashCommandNamedArgument( | 1369 | }), |
| 1369 | 'guard', 'disable loop iteration limit', [ARGUMENT_TYPE.STRING], false, false, null, commonEnumProviders.boolean('onOff')(), | 1370 | SlashCommandNamedArgument.fromProps({ |
| 1370 | ), | 1371 | name: 'guard', |
| 1372 | description: 'disable loop iteration limit', | ||
| 1373 | typeList: [ARGUMENT_TYPE.STRING], | ||
| 1374 | defaultValue: 'off', | ||
| 1375 | enumList: commonEnumProviders.boolean('onOff')(), | ||
| 1376 | }), | ||
| 1371 | ], | 1377 | ], |
| 1372 | unnamedArgumentList: [ | 1378 | unnamedArgumentList: [ |
| 1373 | new SlashCommandArgument( | 1379 | new SlashCommandArgument( |
| @@ -1404,6 +1410,10 @@ export function registerVariableCommands() { | |||
| 1404 | <pre><code class="language-stscript">/setvar key=i 0 | /while left=i right=10 rule=lte "/addvar key=i 1"</code></pre> | 1410 | <pre><code class="language-stscript">/setvar key=i 0 | /while left=i right=10 rule=lte "/addvar key=i 1"</code></pre> |
| 1405 | adds 1 to the value of "i" until it reaches 10. | 1411 | adds 1 to the value of "i" until it reaches 10. |
| 1406 | </li> | 1412 | </li> |
| 1413 | <li> | ||
| 1414 | <pre><code class="language-stscript">/while left={{getvar::currentword}} {: /setvar key=currentword {: /do-something-and-return :}() | /echo The current work is "{{getvar::currentword}}" :}</code></pre> | ||
| 1415 | executes the defined subcommand as long as the "currentword" variable is truthy (has any content that is not false/empty) | ||
| 1416 | </li> | ||
| 1407 | </ul> | 1417 | </ul> |
| 1408 | </div> | 1418 | </div> |
| 1409 | <div> | 1419 | <div> |