Skip to content

Commit

Permalink
fix: parse options ending with 3+ hyphens
Browse files Browse the repository at this point in the history
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 yargs#433
  • Loading branch information
0x2b3bfa0 committed Feb 5, 2022
1 parent 217aa62 commit 31d637a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/yargs-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31d637a

Please sign in to comment.