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

set command line option to value starting with -- (double dash) fails #1602

Closed
rriemann opened this issue Mar 25, 2020 · 6 comments · Fixed by #1603
Closed

set command line option to value starting with -- (double dash) fails #1602

rriemann opened this issue Mar 25, 2020 · 6 comments · Fixed by #1603
Labels

Comments

@rriemann
Copy link

Dear all,

I have a tool with this option:

var args = require('yargs')
  .describe('browser-options', 'Arguments passed over to the browser (Chrome)')
  .nargs('browser-options', 1)
  .array('browser-options')
  .default('browser-options', [])

However, calling my tool with options `--browser-options=--test` does not work. I get the error:

    Not enough arguments following: browser-options

Do I need to apply special shell escaping? I reproduced the problem with both bash and zsh.
@mleguen
Copy link
Member

mleguen commented Mar 26, 2020

Reproduced with master:

  • .array() and .nargs() seem not to be working with --option=--value (value is seen as an independant option)
  • when .array() and .nargs() lines are commented out, --value is seen as the value of option, as expected

@mleguen mleguen added the bug label Mar 26, 2020
@mleguen
Copy link
Member

mleguen commented Mar 26, 2020

I traced the issue back to yargs-parser and will open an issue there.

@mleguen
Copy link
Member

mleguen commented Mar 26, 2020

Issue yargs/yargs-parser#261 opened.

@mleguen
Copy link
Member

mleguen commented Mar 26, 2020

Waiting for yargs/yargs-parser#262 to be merged upstream before fixing it in yargs.

@mleguen
Copy link
Member

mleguen commented Mar 27, 2020

Fix released upstream (thanks again @bcoe). I will include it in yargs ASAP.

@bcoe
Copy link
Member

bcoe commented Mar 27, 2020

@rriemann if you get rid of your package-lock.json and reinstall fresh, this should already be fixed for you.

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