mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-31 03:41:51 +00:00
19 lines
525 B
TypeScript
19 lines
525 B
TypeScript
import { isValueToken } from "../infra/cli-root-options.js";
|
|
|
|
export function takeCliRootOptionValue(
|
|
raw: string,
|
|
next: string | undefined,
|
|
): {
|
|
value: string | null;
|
|
consumedNext: boolean;
|
|
} {
|
|
if (raw.includes("=")) {
|
|
const [, value] = raw.split("=", 2);
|
|
const trimmed = (value ?? "").trim();
|
|
return { value: trimmed || null, consumedNext: false };
|
|
}
|
|
const consumedNext = isValueToken(next);
|
|
const trimmed = consumedNext ? next!.trim() : "";
|
|
return { value: trimmed || null, consumedNext };
|
|
}
|