2026-01-14 01:08:15 +00:00
|
|
|
import { Command } from "commander";
|
|
|
|
|
import { createProgramContext } from "./context.js";
|
2026-01-19 05:34:38 +00:00
|
|
|
import { registerProgramCommands } from "./command-registry.js";
|
2026-01-14 01:08:15 +00:00
|
|
|
import { configureProgramHelp } from "./help.js";
|
|
|
|
|
import { registerPreActionHooks } from "./preaction.js";
|
|
|
|
|
|
|
|
|
|
export function buildProgram() {
|
|
|
|
|
const program = new Command();
|
|
|
|
|
const ctx = createProgramContext();
|
2026-01-18 15:56:24 -05:00
|
|
|
const argv = process.argv;
|
2026-01-14 01:08:15 +00:00
|
|
|
|
|
|
|
|
configureProgramHelp(program, ctx);
|
|
|
|
|
registerPreActionHooks(program, ctx.programVersion);
|
|
|
|
|
|
2026-01-19 05:34:38 +00:00
|
|
|
registerProgramCommands(program, ctx, argv);
|
2026-01-14 01:08:15 +00:00
|
|
|
|
|
|
|
|
return program;
|
|
|
|
|
}
|