API Reference
cac
There're only 4 APIs you need to learn for building simple CLIs: cli.option cli.version cli.help cli.parse.
Official Documentation ↗CompatibilityThis documentation covers version
v7.1.0. Check the official docs for the latest API surface.Installation
npm
npm install cacpnpm
pnpm add cacyarn
yarn add cacMethods
No methods match this filter.
Overview
There’re only 4 APIs you need to learn for building simple CLIs: cli.option cli.version cli.help cli.parse.
API reference status
This page lists only entry points that appear verbatim in the official README examples: command, cac, parse, action. Parameter and return types are not given by the official README, so signatures are marked unverified.
Verification notes
- Official source: https://github.com/egoist/cac
- Evidence: https://cdn.jsdelivr.net/gh/egoist/cac@latest/README.md
- Checked on 2026-11-04 by
scripts/phase11/build-api-profiles.mjs
API reference evidence
Fetched from official sources on 2026-11-08T18:32:00+08:00 via WebFetch https://raw.githubusercontent.com/egoist/cac/main/README.md(返回空);WebFetch https://cdn.jsdelivr.net/gh/egoist/cac@latest/README.md.
command→ signature from https://cdn.jsdelivr.net/gh/egoist/cac@latest/README.md; official text: “#### cli.command(name, description, config?) - Type:(name: string, description: string) => Command”cac→ signature from https://cdn.jsdelivr.net/gh/egoist/cac@latest/README.md; official text: “#### cac(name?) Create a CLI instance, optionally specify the program name which will be used to display in help and version message.”parse→ signature from https://cdn.jsdelivr.net/gh/egoist/cac@latest/README.md; official text: “#### cli.parse(argv?) - Type:(argv = process.argv) => ParsedArgv”action→ signature from https://cdn.jsdelivr.net/gh/egoist/cac@latest/README.md; official text: “#### command.action(callback) - Type:(callback: ActionCallback) => Command”
FAQ
- What does cac do?
- There're only 4 APIs you need to learn for building simple CLIs: cli.option cli.version cli.help cli.parse.
- How do I install cac?
- Run `npm install cac`.
- Where can I verify the API details?
- Official repository/documentation: https://github.com/egoist/cac. Checked on 2026-11-04; signatures and return values not stated in the official README are marked unverified.
Report a problem with this API docOpens a pre-filled issue on GitHub.