mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 01:29:56 +00:00
refactor(scripts): share gateway smoke option tracking (#161605)
This commit is contained in:
parent
91bcd2d68a
commit
006de59604
1 changed files with 6 additions and 14 deletions
|
|
@ -1,4 +1,3 @@
|
|||
// Gateway Smoke script supports OpenClaw repository automation.
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { isRecord } from "@openclaw/normalization-core/record-coerce";
|
||||
import {
|
||||
|
|
@ -52,26 +51,19 @@ function validateArgs(argv: readonly string[]): void {
|
|||
const seen = new Set<string>();
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const arg = argv[index] ?? "";
|
||||
if (BOOLEAN_FLAGS.has(arg)) {
|
||||
if (seen.has(arg)) {
|
||||
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
|
||||
}
|
||||
seen.add(arg);
|
||||
continue;
|
||||
}
|
||||
if (VALUE_FLAGS.has(arg)) {
|
||||
const value = argv[index + 1];
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new GatewaySmokeArgError(`${arg} requires a value`);
|
||||
}
|
||||
if (seen.has(arg)) {
|
||||
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
|
||||
}
|
||||
seen.add(arg);
|
||||
index += 1;
|
||||
continue;
|
||||
} else if (!BOOLEAN_FLAGS.has(arg)) {
|
||||
throw new GatewaySmokeArgError(`Unknown argument: ${arg}`);
|
||||
}
|
||||
throw new GatewaySmokeArgError(`Unknown argument: ${arg}`);
|
||||
if (seen.has(arg)) {
|
||||
throw new GatewaySmokeArgError(`${arg} was provided more than once`);
|
||||
}
|
||||
seen.add(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue