mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-29 19:43:58 +00:00
16 lines
475 B
JavaScript
16 lines
475 B
JavaScript
export function parseMantisCliArgs(argv) {
|
|
const args = {};
|
|
for (let index = 0; index < argv.length; index += 2) {
|
|
const key = argv[index];
|
|
if (!key?.startsWith("--")) {
|
|
throw new Error(`Unexpected argument: ${key}`);
|
|
}
|
|
const name = key.slice(2).replaceAll("-", "_");
|
|
const value = argv[index + 1];
|
|
if (!value || value.startsWith("--")) {
|
|
throw new Error(`Missing value for ${key}`);
|
|
}
|
|
args[name] = value;
|
|
}
|
|
return args;
|
|
}
|