Use int/double auto-parsing and allowed values #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: I didn't test this, and didn't update README, but here's some other stuff unscripted provides that you can take advantage of:
Type annotating parameters with types that have a static
parse
method will automatically use that to validate and parse the argument, and display an error and help text if an invalid value was passed. So in this caseint.parse
anddouble.parse
will be used.allowed
specifies the allowed values of an option, which will also display an error on an invalid value, and will show up in the help. Can pass a List or a Map from values to help text for each value.Either type annotating an option as a List, or specifying
allowMultiple
will mean you can specify option multiple times on the command line, and they will be passed to the function as a List. I filed a bug for unscripted to support comma separated values:seaneagan/unscripted#49