dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.63k stars 278 forks source link

Number-like args incorrectly parsed by Minimist #263

Open mathiscode opened 7 years ago

mathiscode commented 7 years ago

When using arguments such as a hex string that could be interpreted as a numeric value:

mycommand 23782e8821

In lib/util.js, when that argument gets passed to minimist in the parseArgs function, minimist interprets this as a number and returns Infinity.

This is really more of a problem with minimist, but since it no longer appears to be maintained, there should be a solution implemented within Vorpal. Although static types can be assigned for options, this is not so for args.

I will be submitting a PR shortly with a workaround, which tests arguments passed to minimist, and if they are Infinity, it will revert them to the raw value provided before parsing via minimist.