CLI app helper. Use when: Parses arguments; Converts flags to camelCase; Negates flags when using the `--no-` prefix. NOT for: web browser UI rendering; server-side HTML generation.
Install
npx skillscat add yusenthebot/skills-pack/meow Install via the SkillsCat registry.
SKILL.md
meow
Overview
CLI app helper. A popular CLI package for Node.js with 133.6M monthly downloads.
Installation
npm install meowCore API / Usage
npm install meow./foo-app.js unicorns --rainbowCommon Patterns
Pattern 1
#!/usr/bin/env node
import meow from 'meow';
import foo from './lib/index.js';
const cli = meow(`
Usage
$ foo <input>
Options
--rainbow, -r Include a rainbow
Examples
$ foo unicorns --rainbow
🌈 unicorns 🌈
`, {
importMeta: import.meta, // This is required
flags: {
rainbow: {
type: 'boolean',
shortFlag: 'r'
}
}
});
/*
{
input: ['unicorns'],
flags: {rainbow: true},
...
}
*/
foo(cli.input.at(0), cli.flags);Pattern 2
input: {
isRequired: true
}Pattern 3
if (!cli.command) {
cli.showHelp(); // or showHelp(0), or a custom message, or a default command
}Configuration
#!/usr/bin/env node
import meow from 'meow';
import foo from './lib/index.js';
const cli = meow(`
Usage
$ foo <input>
Options
--rainbow, -r Include a rainbow
Examples
$ foo unicorns --rainbow
🌈 unicorns 🌈
`, {
importMeta: import.meta, // This is required
flags: {
rainbow: {
type: 'boolean',
shortFlag: 'r'
}
}
});
/*
{
input: ['unicorns'],
flags: {rainbow: true},
...
}
*/
foo(cli.input.at(0), cli.flags);Tips & Gotchas
- Supports both ESM (
import) and CommonJS (require()). - Current version: 14.1.0. Check the changelog when upgrading across major versions.