Support equals-style boolean values for --open

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 01:59:28 +00:00
1 parent e61ed3ce38
commit 9be9837d48
3 files changed
+24 -2

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ On launch, `t3`:
CLI flags:
- `--no-open[=bool]` — disable browser auto-open (supports `true/false`, `1/0`, `yes/no`, `on/off` in equals form).
- `--open` — force browser auto-open (overrides `T3_NO_OPEN`).
- `--open[=bool]` — force browser auto-open (or explicitly set bool in equals form, overriding `T3_NO_OPEN`).
- `--backend-port <port>` — set WebSocket runtime port.
- `--web-port <port>` — set web UI port.
- `--cwd <path>` — choose launch project directory (defaults to current directory).
+17
View File
@@ -81,6 +81,17 @@ describe("parseCliOptions", () => {
expect(options.noOpen).toBe(false);
});
it("supports explicit equals-style --open boolean overrides", () => {
const options = parseCliOptions(
["--open=false"],
{
T3_NO_OPEN: "false",
},
"/workspace",
);
expect(options.noOpen).toBe(true);
});
it("respects last flag when combining --open and --no-open", () => {
const openThenNoOpen = parseCliOptions(["--open", "--no-open"], {}, "/workspace");
expect(openThenNoOpen.noOpen).toBe(true);
@@ -89,6 +100,12 @@ describe("parseCliOptions", () => {
expect(noOpenThenOpen.noOpen).toBe(false);
});
it("throws for invalid equals-style --open values", () => {
expect(() => parseCliOptions(["--open=maybe"], {}, "/workspace")).toThrow(
"Invalid value for --open",
);
});
it("supports falsey equals-style --no-open values", () => {
const options = parseCliOptions(["--no-open=0"], {}, "/workspace");
expect(options.noOpen).toBe(false);
+6 -1
View File
@@ -216,6 +216,11 @@ export function parseCliOptions(
continue;
}
if (arg.startsWith("--open=")) {
noOpen = !parseBooleanCliValue(arg.split("=")[1] ?? "", "--open");
continue;
}
if (arg.startsWith("--no-open=")) {
noOpen = parseBooleanCliValue(arg.split("=")[1] ?? "", "--no-open");
continue;
@@ -299,7 +304,7 @@ function printHelp(): void {
"",
"Options:",
" --no-open[=bool] Start runtime without opening browser (or explicitly set bool)",
" --open Force browser auto-open",
" --open[=bool] Force browser auto-open (or explicitly set bool)",
" --backend-port <port> Override WebSocket API port (default: 4317)",
" --web-port <port> Override web UI port (default: 4318)",
" --cwd <path> Launch project directory (default: current directory)",