@inceptionstack/roundhouse 0.3.5 → 0.3.6
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/package.json +1 -1
- package/src/cli/cli.ts +18 -7
package/package.json
CHANGED
package/src/cli/cli.ts
CHANGED
|
@@ -609,12 +609,23 @@ const commands: Record<string, () => void | Promise<void>> = {
|
|
|
609
609
|
agent: cmdAgent,
|
|
610
610
|
};
|
|
611
611
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
612
|
+
if (command === "--version" || command === "-v") {
|
|
613
|
+
try {
|
|
614
|
+
const pkg = JSON.parse(
|
|
615
|
+
await readFile(resolve(__dirname, "..", "..", "package.json"), "utf8")
|
|
616
|
+
);
|
|
617
|
+
console.log(pkg.version);
|
|
618
|
+
} catch {
|
|
619
|
+
console.log("unknown");
|
|
620
|
+
}
|
|
618
621
|
} else {
|
|
619
|
-
|
|
622
|
+
const fn = command ? commands[command] : undefined;
|
|
623
|
+
if (fn) {
|
|
624
|
+
Promise.resolve(fn()).catch((err) => {
|
|
625
|
+
console.error(`[roundhouse] ${command} failed:`, err);
|
|
626
|
+
process.exit(1);
|
|
627
|
+
});
|
|
628
|
+
} else {
|
|
629
|
+
printHelp();
|
|
630
|
+
}
|
|
620
631
|
}
|