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

BUG: function unknown called for non-options #1

Open
meszaros-lajos-gyorgy opened this issue Dec 22, 2021 · 0 comments
Open

BUG: function unknown called for non-options #1

meszaros-lajos-gyorgy opened this issue Dec 22, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@meszaros-lajos-gyorgy
Copy link
Owner

Original issue by @johndeighan at https://github.com/substack/minimist/issues/161

when I pass this to parseArgs() (using 'import parseArgs from 'minimist';' in an ES6 module'):

[ 'test/TopMenuShort.starbucks' ]

For example, my command line is node myscript.js test/TopMenuShort.starbucks, my "unknown" function is called, and this is output (though I've realized that this line is printed by my "unknown" function):

Unknown option: -test/TopMenuShort.starbucks

But the return value from parseArgs() is correct:

{
  _: [ 'test/TopMenuShort.starbucks' ],
  c: false,
  j: false,
  s: false,
  h: false,
  d: false
}

My work around is to simply return true from my "unknown" function, but that still has the problem that I can't just print the "unknown option" error message. I'm pretty sure that the function should only be called for unknown options, not for non-options on the command line.

@meszaros-lajos-gyorgy meszaros-lajos-gyorgy added the bug Something isn't working label Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant