fix(scripts): reject short flag TUI PTY values

This commit is contained in:
Vincent Koc
2026-06-21 22:52:08 +02:00
parent 179eb15554
commit dfbc9ab246
2 changed files with 9 additions and 1 deletions

View File

@@ -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();

View File

@@ -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",