Closed bcoe closed 2 years ago
Yes, double dash should signal an end to parsing.
I assume _
is positionals
. Not sure if you are wondering about ending the option processing, or about whether to include --
in positionals
. In any case, a short answer...
I am happy with the currently implemented behaviour, that the --
is consumed and the remaining arguments are put into positionals
(and not examined for options).
(I suggested README changes describing the current behaviour for --
in abandoned #34.)
Yes, this is generally the DX I've seen in Node.js-based tooling.
The current behaviour implemented in parseArgs
is the same as in all the reference implementations from #76:
try-getopt-long % ./ex foo -- bar --option
non-option ARGV-elements: foo bar --option
try-commander % node index.js foo -- bar --option
positionals: [ 'foo', 'bar', '--option' ]
try-yargs % node index.js foo -- bar --option
{ _: [ 'foo', 'bar', '--option' ], '$0': 'index.js' }
try-minimist % node index.js foo -- bar --option
{ _: [ 'foo', 'bar', '--option' ] }
Perhaps we should just put
--
in_
, and an implementer could fallback to callingslice
onprocess.argv
, if they observe it?