mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
fix(scripts): reject short flag closeout values
This commit is contained in:
parent
86fea26797
commit
1b17517969
2 changed files with 22 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ function parseArgs(argv) {
|
|||
throw new Error(`unexpected argument: ${key}`);
|
||||
}
|
||||
const value = argv[index + 1];
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new Error(`${key} requires a value.`);
|
||||
}
|
||||
values.set(key.slice(2), value);
|
||||
|
|
|
|||
21
test/scripts/verify-stable-main-closeout.test.ts
Normal file
21
test/scripts/verify-stable-main-closeout.test.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Verify Stable Main Closeout tests cover stable closeout CLI behavior.
|
||||
import { spawnSync } from "node:child_process";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
function runCli(...args: string[]) {
|
||||
return spawnSync(process.execPath, ["scripts/verify-stable-main-closeout.mjs", ...args], {
|
||||
cwd: path.resolve("."),
|
||||
encoding: "utf8",
|
||||
});
|
||||
}
|
||||
|
||||
describe("verify-stable-main-closeout", () => {
|
||||
it("rejects option-shaped values before checking required arguments", () => {
|
||||
const result = runCli("--tag", "-h");
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stdout).toBe("");
|
||||
expect(result.stderr.trim()).toBe("--tag requires a value.");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue