-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-
can not be string value
#15
Comments
This line dates back to 7cced88#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R63 - iow, it's always been in minimist (and presumably optimist, its precursor, as well). I agree that an argument value of |
Maybe |
The test is done in two places, for a short option and for a long option, and I think should be the same. The pattern used in the other place is more careful and won't fire for a plain Line 220 in 5784b17
|
We are having a similar issue, we are trying to run a command with option {
"1": true,
"9": true,
"i": true,
"r": true,
"M": true,
"K": true,
"Q": true,
"o": true,
"U": true,
"j": true,
"Z": true,
"d": true,
"x": true,
"g": true,
"v": true,
"q": true,
"V": true,
"Y": true,
"A": true,
"B": true,
"E": true,
"u": true,
"w": true
} Id should be parsed as string and not as flags. |
@milanholemans Minimist assumes arguments which start with a dash are an option (or options) and not consumed as an option argument. A fix for single dash won't change this behaviour. To get the parsing you expect, use an embedded option value with an
Then a possible dash on the start of the id will not change the parsing. |
I assumed this was the problem indeed.
This seems to be working indeed, awesome! Thanks for the fast feedback @shadowspawn! |
Hello. I also have the same problem, and the suggestions here don't solve it 100%.
This does not work if the value contains a space. you need both an =, and quotation marks " around the parameter.
Describe the exact steps which reproduce the problem // test.js
import minimist from 'minimist';
const options = minimist(process.argv.slice(2));
console.log(options); Running the following command gives this output:
Expected output:
When writing out the command using BOTH an = (equals) and quotation marks, it works as expected.
|
The regex
/^-/
matches-
, making argument valued by-
character only not available.-
is commonly used as the reference of stdin.minimist/index.js
Line 167 in 5784b17
The text was updated successfully, but these errors were encountered: