Skip to content

Commit 4d3e614

Browse files
centdixclaude
andauthored
feat: add --version / -V flag (#101)
* nit * feat: add --version / -V flag to print current version Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: add missing break after --version case Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d08512d commit 4d3e614

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

bin/src/webmux.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { resolve, dirname, join } from "node:path";
44
import { existsSync } from "node:fs";
55
import { fileURLToPath } from "node:url";
66
import type { Subprocess } from "bun";
7+
import pkg from "../../package.json";
78

89
// ── Helpers ──────────────────────────────────────────────────────────────────
910

@@ -29,6 +30,7 @@ Usage:
2930
Options:
3031
--port N Set port (default: 5111)
3132
--debug Show debug-level logs
33+
--version Show version number
3234
--help Show this help message
3335
3436
Environment:
@@ -60,7 +62,7 @@ function isRootCommand(value: string): value is NonNullable<RootCommand> {
6062
}
6163

6264
function isServeRootOption(value: string): boolean {
63-
return value === "--port" || value === "--debug" || value === "--help" || value === "-h";
65+
return value === "--port" || value === "--debug" || value === "--help" || value === "-h" || value === "--version" || value === "-V";
6466
}
6567

6668
export function parseRootArgs(args: string[]): ParsedRootArgs {
@@ -94,6 +96,11 @@ export function parseRootArgs(args: string[]): ParsedRootArgs {
9496
case "--debug":
9597
debug = true;
9698
break;
99+
case "--version":
100+
case "-V":
101+
console.log(pkg.version);
102+
process.exit(0);
103+
break;
97104
case "--help":
98105
case "-h":
99106
usage();

0 commit comments

Comments
 (0)