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
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 -: /^(-|--)[^-]/
@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 = like:
--id=-9rMKQooUjZdxgv1qQVZYABEuw
Then a possible dash on the start of the id will not change the parsing.
Reacted by Jordan Harband, Milan Holemans and Fabio Spampinato
Activity
ljharb commentedon Dec 13, 2022
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
-should be permitted. Want to send a PR with a test case, and perhaps also a fix?Yesterday17 commentedon Dec 14, 2022
Maybe
/^-./could work?shadowspawn commentedon Dec 14, 2022
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
-:/^(-|--)[^-]/minimist/index.js
Line 220 in 5784b17
milanholemans commentedon Dec 19, 2022
We are having a similar issue, we are trying to run a command with option
--id "-9rMKQooUjZdxgv1qQVZYABEuw".After parsing, it looks like:
{ "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.
shadowspawn commentedon Dec 19, 2022
@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
=like:--id=-9rMKQooUjZdxgv1qQVZYABEuwThen a possible dash on the start of the id will not change the parsing.
milanholemans commentedon Dec 19, 2022
I assumed this was the problem indeed.
This seems to be working indeed, awesome! Thanks for the fast feedback @shadowspawn!
topaz1008 commentedon Dec 28, 2022
Hello.
I also have the same problem, and the suggestions here don't solve it 100%.
I am using Windows10 and Node.js v18.12.1
This does not work if the value contains a space. you need both an =, and quotation marks " around the parameter.
e.g.
Describe the exact steps which reproduce the problem
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.
e.g.
[Fix] Fix long option followed by single dash
[Fix] Fix long option followed by single dash (#17)