Skip to content

Commit 3fc7bee

Browse files
committed
refactor unknown flag creation in strict type failures
1 parent 3882545 commit 3fc7bee

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@author.io/arg",
3-
"version": "1.3.16",
3+
"version": "1.3.17",
44
"description": "An argument parser for CLI applications.",
55
"main": "src/index.js",
66
"exports": {

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ class Parser {
233233

234234
if (typeof flag.value !== flag.type) {
235235
if (flag.type === 'boolean') {
236-
this.addFlag(flag.value)
236+
const unknownFlag = new Flag(this.#cleanFlag(flag.value))
237+
unknownFlag.strictTypes = false
238+
this.#unknownFlags.set(this.#cleanFlag(flag.value), unknownFlag)
239+
237240
flag.value = true
238241
}
239242
}

0 commit comments

Comments
 (0)