Skip to content

Conversation

mleguen
Copy link
Member

@mleguen mleguen commented Dec 4, 2019

Closes #226.

Fixes 3 bugs in hasAnyFlag:

  1. using ... inside concat flattens all arrays. So if flags.string (for example) is an array of string, toCheck does not contain this array of string, but the strings directly. And a few lines below, if flag is a string, flag[repeat] evaluates to true (as with any method names of String.prototype)
  2. once corrected the first bug, if flag is now an array, flag[some] evaluates to true (Array.prototype...)
  3. same thing for the methodes of Object.prototype if flag is an object

By the way, yargs-parser crashes when passing a --toString option: I thing this kind of bug has to be tracked everywhere in the code (I will open another issue for this).

@bcoe bcoe changed the title fix: handle properly array and object flags in hasAnyFlag fix: address bugs with "uknown-options-as-args" Feb 9, 2020
@bcoe bcoe merged commit bc023e3 into master Feb 9, 2020
@bcoe bcoe deleted the fix/226-repeat-not-unknown-option branch February 9, 2020 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

repeat options is not considered as an unknown option with unknown-options-as-args
2 participants