Add -o short alias for open flag
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
d95e2fc125
commit
6509eefec2
3 files changed
+15
-3
No files matched your search
@@ -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 <port>` — set WebSocket runtime port.
|
||||
- `--web-port <port>` — set web UI port.
|
||||
- `--cwd <path>` — choose launch project directory (defaults to current directory).
|
||||
|
||||
@@ -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"],
|
||||
|
||||
+3
-2
@@ -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 <port> Override WebSocket API port (default: 4317)",
|
||||
" --web-port <port> Override web UI port (default: 4318)",
|
||||
" --cwd <path> Launch project directory (default: current directory)",
|
||||
|
||||
Reference in new issue
Block a user