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.
CLI app helper. A popular CLI package for Node.js with 133.6M monthly downloads.
npm install meow
npm install meow
./foo-app.js unicorns --rainbow
#!/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);