You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But, shockingly, if the argument happens to contain the strings "true" or "false" anywhere in the string, then the argument gets reinterpreted as an argument for the -f flag:
The value of the -f flag is false in both cases, but the argument mysteriously vanishes from the _ array.
This is especially surprising if, for example, your program works fine until you happen to use a file with "true" in its name. I would expect the argument list to be left alone entirely, regardless of its content, when used with a boolean flag.
Tests run with minimist@1.2.0 using Node v4.2.1 on OS X.
The text was updated successfully, but these errors were encountered:
Copied from original repo. Single comment from @sampsyo with no upvotes:
https://web.archive.org/web/20200904203601/https://github.com/substack/minimist/issues/75/
Consider this tiny program that uses a single boolean flag:
It works as expected for most arguments:
But, shockingly, if the argument happens to contain the strings "true" or "false" anywhere in the string, then the argument gets reinterpreted as an argument for the -f flag:
The value of the
-f
flag is false in both cases, but the argument mysteriously vanishes from the_
array.This is especially surprising if, for example, your program works fine until you happen to use a file with "true" in its name. I would expect the argument list to be left alone entirely, regardless of its content, when used with a boolean flag.
Tests run with
minimist@1.2.0
using Node v4.2.1 on OS X.The text was updated successfully, but these errors were encountered: