@fastino-ai/pioneer-cli 0.2.1 → 0.2.2
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/index.tsx +19 -1
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -56,7 +56,17 @@ function parseArgs(argv: string[]): { command: string[]; flags: Record<string, s
|
|
|
56
56
|
if (arg.startsWith("--")) {
|
|
57
57
|
const key = arg.slice(2);
|
|
58
58
|
const next = argv[i + 1];
|
|
59
|
-
if (next && !next.startsWith("
|
|
59
|
+
if (next && !next.startsWith("-")) {
|
|
60
|
+
flags[key] = next;
|
|
61
|
+
i++;
|
|
62
|
+
} else {
|
|
63
|
+
flags[key] = "true";
|
|
64
|
+
}
|
|
65
|
+
} else if (arg.startsWith("-") && arg.length === 2) {
|
|
66
|
+
// Handle short flags like -v, -h
|
|
67
|
+
const key = arg.slice(1);
|
|
68
|
+
const next = argv[i + 1];
|
|
69
|
+
if (next && !next.startsWith("-")) {
|
|
60
70
|
flags[key] = next;
|
|
61
71
|
i++;
|
|
62
72
|
} else {
|
|
@@ -1027,10 +1037,18 @@ const App: React.FC<AppProps> = ({ command, flags }) => {
|
|
|
1027
1037
|
// Entry point
|
|
1028
1038
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1029
1039
|
|
|
1040
|
+
import packageJson from "../package.json";
|
|
1041
|
+
|
|
1030
1042
|
function main() {
|
|
1031
1043
|
const argv = process.argv.slice(2);
|
|
1032
1044
|
const { command, flags } = parseArgs(argv);
|
|
1033
1045
|
|
|
1046
|
+
// Handle version flag early (before React render)
|
|
1047
|
+
if (flags.version === "true" || flags.v === "true") {
|
|
1048
|
+
console.log(`pioneer ${packageJson.version}`);
|
|
1049
|
+
process.exit(0);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1034
1052
|
render(<App command={command} flags={flags} />);
|
|
1035
1053
|
}
|
|
1036
1054
|
|