From 31d637a26ea58018ab06c2050bc5b30f3430f861 Mon Sep 17 00:00:00 2001 From: 0x2b3bfa0 <0x2b3bfa0+git@googlemail.com> Date: Sun, 6 Feb 2022 00:36:09 +0100 Subject: [PATCH] fix: parse options ending with 3+ hyphens Before this commit, options ending with three or more hyphens were being parsed as positional arguments, because a regular expression didn't have a start anchor. Closes #433 --- lib/yargs-parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/yargs-parser.ts b/lib/yargs-parser.ts index 571a0cbc..5f776705 100644 --- a/lib/yargs-parser.ts +++ b/lib/yargs-parser.ts @@ -225,7 +225,7 @@ export class YargsParser { if (arg !== '--' && isUnknownOptionAsArg(arg)) { pushPositional(arg) // ---, ---=, ----, etc, - } else if (truncatedArg.match(/---+(=|$)/)) { + } else if (truncatedArg.match(/^---+(=|$)/)) { // options without key name are invalid. pushPositional(arg) continue