refactor: share plugin setup helpers

This commit is contained in:
Peter Steinberger
2026-03-26 18:34:51 +00:00
parent c98addeadd
commit cca577a0cc
10 changed files with 88 additions and 144 deletions

View File

@@ -0,0 +1,21 @@
import { consumeRootOptionToken } from "../infra/cli-root-options.js";
export function forwardConsumedCliRootOption(
args: readonly string[],
index: number,
out: string[],
): number {
const consumedRootOption = consumeRootOptionToken(args, index);
if (consumedRootOption <= 0) {
return 0;
}
for (let offset = 0; offset < consumedRootOption; offset += 1) {
const token = args[index + offset];
if (token !== undefined) {
out.push(token);
}
}
return consumedRootOption;
}