mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-14 00:26:10 +00:00
fix(scripts): reject short flag TUI PTY values
This commit is contained in:
@@ -63,7 +63,7 @@ function readOption(args: string[], name: string): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
const value = args[idx + 1];
|
||||
if (!value || value.startsWith("--")) {
|
||||
if (!value || value.startsWith("-")) {
|
||||
throw new CliArgumentError(`${name} requires a value`);
|
||||
}
|
||||
return value.trim();
|
||||
|
||||
@@ -356,6 +356,14 @@ describe("script-specific dev tooling hardening", () => {
|
||||
expect(result.stdout).toBe("");
|
||||
});
|
||||
|
||||
it("rejects short flags as TUI PTY watch option values", () => {
|
||||
for (const flag of ["--mode", "--mirror-path"]) {
|
||||
expect(() => tuiPtyWatchTesting.parseOptions([flag, "-h"])).toThrow(
|
||||
`${flag} requires a value`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps TUI PTY watch vitest args behind the separator", () => {
|
||||
expect(tuiPtyWatchTesting.parseOptions(["--mode", "all", "--", "--help"])).toMatchObject({
|
||||
mode: "all",
|
||||
|
||||
Reference in New Issue
Block a user