API Reference
meow
Minimal CLI helper that parses flags and positional input, generates help, and manages version output.
Official Documentation ↗CompatibilityThis documentation covers version
v14.1.0. Check the official docs for the latest API surface.Installation
npm
npm install meowpnpm
pnpm add meowMethods
No methods match this filter.
Overview
meow is a minimal CLI helper that parses flags and positional input and generates help and version output. This reference lists the most frequently used APIs with accurate signatures and runnable snippets.
Core APIs
meow— Creates a CLI helper that parses argv and exposes input and flags.cli.flags— Provides parsed and camelCased flag values from the command line.cli.input— Contains the positional arguments passed after the flags.
Example
import meow from 'meow';
const cli = meow('Usage: app <input>', {
flags: { uppercase: { type: 'boolean', alias: 'u' } },
});
console.log(cli.input, cli.flags.uppercase);
Notes
Recent versions are ESM-only and camelCase flag names, so kebab-case flags become camelCase keys on cli.flags.
Verification
Invoke the CLI with a boolean alias flag and confirm cli.flags exposes it under the camelCased name.
FAQ
- Why does meow require ESM?
- Recent major versions are ESM-only, so import meow from "meow" and set type module or use a .mjs entry.
- How do I add aliases to flags?
- Set the alias property on a flag definition, such as { type: "boolean", alias: "u" }, to allow -u as well.
- How do I customize the help output?
- Pass a helpText string or a help object with description, usage, and option lists to control what --help prints.
Report a problem with this API docOpens a pre-filled issue on GitHub.