-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·31 lines (24 loc) · 812 Bytes
/
index.js
File metadata and controls
executable file
·31 lines (24 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env node
import { createRequire } from "module"
import { main } from "./src/main.js"
import { handleBuiltInCommand } from "./src/cli/commands.js"
import { parseCliArgs, printUsageAndExit } from "./src/cli/args.js"
const require = createRequire(import.meta.url)
const pkg = require("./package.json")
const { showVersion, command, subcommand } = parseCliArgs(process.argv.slice(2))
if (showVersion) {
console.log(pkg.version)
process.exit(0)
}
if (command && !["setup", "update", "config", "model"].includes(command)) {
console.error(`Unknown command: ${command}`)
printUsageAndExit(1)
}
if (command) {
await handleBuiltInCommand(command, subcommand)
process.exit(0)
}
main().catch((error) => {
console.error("Unexpected error:", error.message)
process.exit(1)
})