Skip to content
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

should "--" signal an end to parsing? #58

Closed
bcoe opened this issue Feb 5, 2022 · 4 comments
Closed

should "--" signal an end to parsing? #58

bcoe opened this issue Feb 5, 2022 · 4 comments

Comments

@bcoe
Copy link
Collaborator

bcoe commented Feb 5, 2022

Perhaps we should just put -- in _, and an implementer could fallback to calling slice on process.argv, if they observe it?

@bcoe bcoe added the discussion label Feb 5, 2022
@ljharb
Copy link
Member

ljharb commented Feb 5, 2022

Yes, double dash should signal an end to parsing.

@shadowspawn
Copy link
Collaborator

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.)

@bnb
Copy link

bnb commented Feb 18, 2022

Yes, this is generally the DX I've seen in Node.js-based tooling.

@shadowspawn
Copy link
Collaborator

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' ] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants