cue-console 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cue-console.js +27 -2
- package/package.json +1 -1
package/bin/cue-console.js
CHANGED
|
@@ -6,7 +6,7 @@ let path;
|
|
|
6
6
|
|
|
7
7
|
function printHelp() {
|
|
8
8
|
process.stdout.write(
|
|
9
|
-
`cue-console - Cue Hub console launcher\n\nUsage:\n cue-console <dev|build|start> [--port <port>] [--host <host>]\n\nExamples:\n cue-console start --port 3000\n cue-console start --host 0.0.0.0 --port 3000\n\nNotes:\n - start will auto-build if needed (when .next is missing)\n`
|
|
9
|
+
`cue-console - Cue Hub console launcher\n\nUsage:\n cue-console <dev|build|start> [--port <port>] [--host <host>]\n cue-console -v|--version\n\nExamples:\n cue-console -v\n cue-console start --port 3000\n cue-console start --host 0.0.0.0 --port 3000\n\nNotes:\n - start will auto-build if needed (when .next is missing)\n`
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -18,6 +18,7 @@ function parseArgs(argv) {
|
|
|
18
18
|
host: undefined,
|
|
19
19
|
passthrough: [],
|
|
20
20
|
showHelp: false,
|
|
21
|
+
showVersion: false,
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
if (args.length === 0 || args[0] === "-h" || args[0] === "--help") {
|
|
@@ -25,6 +26,11 @@ function parseArgs(argv) {
|
|
|
25
26
|
return out;
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
if (args[0] === "-v" || args[0] === "--version") {
|
|
30
|
+
out.showVersion = true;
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
out.command = args.shift();
|
|
29
35
|
|
|
30
36
|
while (args.length > 0) {
|
|
@@ -51,7 +57,26 @@ async function main() {
|
|
|
51
57
|
path = await import("node:path");
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
const { command, port, host, passthrough } = parseArgs(process.argv.slice(2));
|
|
60
|
+
const { command, port, host, passthrough, showHelp, showVersion } = parseArgs(process.argv.slice(2));
|
|
61
|
+
|
|
62
|
+
if (showHelp) {
|
|
63
|
+
printHelp();
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (showVersion) {
|
|
68
|
+
const pkgRoot = path.resolve(__dirname, "..");
|
|
69
|
+
const pkgPath = path.join(pkgRoot, "package.json");
|
|
70
|
+
try {
|
|
71
|
+
const txt = fs.readFileSync(pkgPath, "utf8");
|
|
72
|
+
const pkg = JSON.parse(txt);
|
|
73
|
+
process.stdout.write(String(pkg?.version || "") + "\n");
|
|
74
|
+
process.exit(0);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
process.stderr.write(String(err?.stack || err) + "\n");
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
55
80
|
|
|
56
81
|
if (!command) {
|
|
57
82
|
printHelp();
|