Skip to content

Commit

Permalink
refactor unknown flag creation in strict type failures
Browse files Browse the repository at this point in the history
  • Loading branch information
coreybutler committed Oct 17, 2021
1 parent 3882545 commit 3fc7bee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@author.io/arg",
"version": "1.3.16",
"version": "1.3.17",
"description": "An argument parser for CLI applications.",
"main": "src/index.js",
"exports": {
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ class Parser {

if (typeof flag.value !== flag.type) {
if (flag.type === 'boolean') {
this.addFlag(flag.value)
const unknownFlag = new Flag(this.#cleanFlag(flag.value))
unknownFlag.strictTypes = false
this.#unknownFlags.set(this.#cleanFlag(flag.value), unknownFlag)

flag.value = true
}
}
Expand Down

0 comments on commit 3fc7bee

Please sign in to comment.