From 91b145174379d4b10347ab55829bf8c282b3d8b6 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Thu, 21 Sep 2023 16:26:55 -0400 Subject: [PATCH] fix(core): ensure target-only argument is rewritten correctly to be forwarded (#17971) --- packages/nx/bin/init-local.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nx/bin/init-local.ts b/packages/nx/bin/init-local.ts index 757025f4d3461..8fba12cbba844 100644 --- a/packages/nx/bin/init-local.ts +++ b/packages/nx/bin/init-local.ts @@ -87,7 +87,10 @@ function rewritePositionalArguments(args: string[]) { const relevantPositionalArgs = []; const rest = []; for (let i = 2; i < args.length; i++) { - if (!args[i].startsWith('-')) { + if (args[i] === '--') { + rest.push(...args.slice(i + 1)); + break; + } else if (!args[i].startsWith('-')) { relevantPositionalArgs.push(args[i]); if (relevantPositionalArgs.length === 2) { rest.push(...args.slice(i + 1));