21 lines
635 B
TypeScript
21 lines
635 B
TypeScript
#!/usr/bin/env bun
|
|
|
|
import { createMain } from "citty";
|
|
import { initializeCompletion, main } from "./command/main";
|
|
import { provideContext } from "./lib/context";
|
|
import { extractConfigArgument } from "./lib/config";
|
|
import { formatUnknownError, wrapCommandErrors } from "./lib/error";
|
|
|
|
async function run() {
|
|
await initializeCompletion();
|
|
wrapCommandErrors(main);
|
|
const cli = createMain(main);
|
|
const { configPath, rawArgs } = extractConfigArgument(process.argv.slice(2));
|
|
await provideContext(() => cli({ rawArgs }), configPath);
|
|
}
|
|
|
|
run().catch((e) => {
|
|
console.error(formatUnknownError(e));
|
|
process.exitCode = 1;
|
|
});
|