diff --git a/README.md b/README.md index 0f0d861126..a80f45e74f 100644 --- a/README.md +++ b/README.md @@ -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[=bool]` — force browser auto-open (supports `true/false`, `1/0`, `yes/no`, `on/off` in equals form; overrides `T3_NO_OPEN`). +- `-o, --open[=bool]` — force browser auto-open (supports `true/false`, `1/0`, `yes/no`, `on/off` in equals form; overrides `T3_NO_OPEN`). - `--backend-port ` — set WebSocket runtime port. - `--web-port ` — set web UI port. - `--cwd ` — choose launch project directory (defaults to current directory). diff --git a/apps/t3/src/cli.test.ts b/apps/t3/src/cli.test.ts index c7930cd129..1f60afa5f9 100644 --- a/apps/t3/src/cli.test.ts +++ b/apps/t3/src/cli.test.ts @@ -81,6 +81,17 @@ describe("parseCliOptions", () => { expect(options.noOpen).toBe(false); }); + it("supports -o as a short alias for --open", () => { + const options = parseCliOptions( + ["-o"], + { + T3_NO_OPEN: "true", + }, + "/workspace", + ); + expect(options.noOpen).toBe(false); + }); + it("supports explicit equals-style --open boolean overrides", () => { const options = parseCliOptions( ["--open=false"], diff --git a/apps/t3/src/cli.ts b/apps/t3/src/cli.ts index cce8646c6c..6c9d39fd2b 100644 --- a/apps/t3/src/cli.ts +++ b/apps/t3/src/cli.ts @@ -102,6 +102,7 @@ const KNOWN_CLI_FLAGS = new Set([ "--version", "-v", "--open", + "-o", "--no-open", "--backend-port", "--web-port", @@ -229,7 +230,7 @@ export function parseCliOptions( continue; } - if (arg === "--open") { + if (arg === "--open" || arg === "-o") { noOpen = false; continue; } @@ -322,7 +323,7 @@ function printHelp(): void { "", "Options:", " --no-open[=bool] Start runtime without opening browser (or explicitly set bool)", - " --open[=bool] Force browser auto-open (or explicitly set bool)", + " -o, --open[=bool] Force browser auto-open (or explicitly set bool)", " --backend-port Override WebSocket API port (default: 4317)", " --web-port Override web UI port (default: 4318)", " --cwd Launch project directory (default: current directory)",