mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-09 03:22:40 +00:00
fix(scripts): reject short flag gauntlet values
This commit is contained in:
@@ -82,7 +82,7 @@ export function parseArgs(argv) {
|
||||
const arg = args[index];
|
||||
const readValue = () => {
|
||||
const value = args[index + 1];
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new Error(`Missing value for ${arg}`);
|
||||
}
|
||||
index += 1;
|
||||
|
||||
@@ -132,8 +132,29 @@ describe("plugin gateway gauntlet helpers", () => {
|
||||
});
|
||||
|
||||
it("rejects valued flags followed by another option", () => {
|
||||
for (const flag of ["--repo-root", "--output-dir", "--plugin", "--qa-scenario"]) {
|
||||
expect(() => parseArgs([flag, "--skip-qa"])).toThrow(`Missing value for ${flag}`);
|
||||
for (const flag of [
|
||||
"--repo-root",
|
||||
"--output-dir",
|
||||
"--plugin",
|
||||
"--shard-total",
|
||||
"--shard-index",
|
||||
"--limit",
|
||||
"--qa-scenario",
|
||||
"--qa-plugin-chunk-size",
|
||||
"--cpu-core-warn",
|
||||
"--hot-wall-warn-ms",
|
||||
"--max-rss-warn-mb",
|
||||
"--wall-anomaly-multiplier",
|
||||
"--rss-anomaly-multiplier",
|
||||
"--qa-cpu-regression-multiplier",
|
||||
"--qa-wall-regression-multiplier",
|
||||
"--command-timeout-ms",
|
||||
"--build-timeout-ms",
|
||||
"--qa-timeout-ms",
|
||||
]) {
|
||||
for (const value of ["--skip-qa", "-h"]) {
|
||||
expect(() => parseArgs([flag, value])).toThrow(`Missing value for ${flag}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user