From 33cf8134413a1f89135f38665dfbc8105c330b0b Mon Sep 17 00:00:00 2001 From: Connor Berghoffer Date: Wed, 19 Nov 2025 16:33:19 +1300 Subject: [PATCH] fix: negative flags only work with double dash Single dash negative flags like -no-flag were incorrectly parsing as boolean negation. Now only double dash --no-flag syntax works for negation, which matches standard CLI conventions. Fixes #209 --- src/_parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_parser.ts b/src/_parser.ts index 2a53a0f..490486e 100644 --- a/src/_parser.ts +++ b/src/_parser.ts @@ -119,7 +119,7 @@ export function parseRawArgs( if (j === 0) { out._.push(arg); - } else if (arg.substring(j, j + 3) === "no-") { + } else if (j === 2 && arg.substring(j, j + 3) === "no-") { name = arg.slice(Math.max(0, j + 3)); if (strict && !~keys.indexOf(name)) { return opts.unknown(arg);