parser
parser copied to clipboard
Invoke arg parse function before checking options
Consider an arg definition like this:
{
name: 'something',
required: true,
parse: input => input.toUpperCase(),
options: ['A', 'B'],
}
Logically an input token of a
should be acceptable here because the parse
function is provided in order to coerce the lower case value into an upper case value.
This, however, does not work since the token is compared to the options before the parse function is invoked. While in this synthetic case this is easy enough to workaround, in more complex cases it would not be quite so easy.