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

the new version (17.1.0) fails with Unknown argument: xxx #1999

Closed
rafipiccolo opened this issue Aug 5, 2021 · 2 comments
Closed

the new version (17.1.0) fails with Unknown argument: xxx #1999

rafipiccolo opened this issue Aug 5, 2021 · 2 comments
Labels

Comments

@rafipiccolo
Copy link

i use this script

let yargs = require('yargs');

const argv = yargs
    .usage('Usage: $0 <command> [arguments]')
    .help('h')
    .alias('h', 'help')
    .version('1.0')
    .strict()
    .wrap(null)
    .option('list', {
        alias: 'l',
        type: 'boolean',
        description: 'list existing projects and exit',
    }).argv;

when i call the script i get :

# node /script.js -l xxx
Usage: script.js <command> [arguments]

Options:
  -h, --help        Show help  [boolean]
      --version     Show version number  [boolean]
  -l, --list        list existing projects and exit  [boolean]

Unknown argument: xxx

it doesnt block the use when i use version yargs ^17.0.1
it fails with version ^17.1.0

@rafipiccolo rafipiccolo changed the title the new version fails with Unknown argument: xxx the new version (17.1.0) fails with Unknown argument: xxx Aug 5, 2021
@bcoe bcoe added the question label Aug 5, 2021
@bcoe
Copy link
Member

bcoe commented Aug 5, 2021

@rafipiccolo I believe you were relying on a bug fixed in #1977

If you use .strictOptions rather than .strict, I think you'll get the behavior you want.

@rafipiccolo
Copy link
Author

my bad :) makes sens.
Now it works.
thanks

guendto added a commit to guendto/jinqr that referenced this issue Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants