mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 17:21:13 +00:00
refactor: share plugin setup helpers
This commit is contained in:
21
src/cli/root-option-forward.ts
Normal file
21
src/cli/root-option-forward.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user