Function: createProgram()
createProgram():
Command
Defined in: packages/cli/src/index.ts:272
Creates the Commander.js CLI program for zod-to-form.
Registers the generate and init sub-commands with all their options and
action handlers. Consumers can pass the returned Command to .parseAsync()
to run the CLI, or use it for testing without spawning a child process.
Returns
Command
A fully configured Command instance ready to be parsed.
Use When
- Testing CLI commands programmatically without spawning a child process
- Extending the CLI with custom sub-commands in a wrapper tool
Avoid When
- You just want to generate a form from a script — use
runGenerate()directly - End-user invocation — use
npx zod-to-form(the binary entry point) instead
Pitfalls
- NEVER call
program.parse()(synchronous) in ESM environments — use.parseAsync(process.argv)instead or the program will silently not execute