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

<foo> syntax is now missing when unknown-options-as-args is on #1444

Closed
kellyselden opened this issue Oct 9, 2019 · 1 comment · Fixed by #1508
Closed

<foo> syntax is now missing when unknown-options-as-args is on #1444

kellyselden opened this issue Oct 9, 2019 · 1 comment · Fixed by #1508
Labels

Comments

@kellyselden
Copy link
Contributor

ember-cli/ember-cli-update#688

unknown-options-as-args is working as expected for one of my commands https://github.com/ember-cli/ember-cli-update/pull/688/files#diff-2d1ba175f25c88b4ca647166ccdf58c8R22, but it's causing another command to fail https://github.com/ember-cli/ember-cli-update/blob/3b385ee9c1f2e44631b8bce3f4ab9a60b7bdbf54/bin/commands/install.js#L5 where argv only has

{ _: [ 'install' ],
  '$0': '/Users/kselden/code/ember-cli-update/bin/ember-cli-update' }
@mleguen
Copy link
Member

mleguen commented Nov 27, 2019

Here is a simple use case to reproduce this issue.

First without unknown-options-as-args:

const yargs = require('yargs')

console.log(
yargs
  .command('$0 <addon>')
  .parse()
)

argv.addon is populated as expected:

$ node index.js totoro
{ _: [], '$0': 'index.js', addon: 'totoro' }

Then with unknown-options-as-args:

const yargs = require('yargs')

console.log(
yargs
  .command('$0 <addon>')
  .parserConfiguration({
    'unknown-options-as-args': true
  })
  .parse()
)

argv.addon is no longer populated:

$ node index.js totoro
{ _: [], '$0': 'index.js' }

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