cli-meow-help

raw JSON →
4.0.0 verified Sat Apr 25 auth: no javascript

Generates automatically formatted help text for meow-based CLI applications. v4.0.0 is the current stable release, with moderate release cadence. Key differentiators: it provides a simple declarative API to generate help text by specifying commands, flags, examples, and optional header/footer, avoiding manual formatting. It integrates tightly with meow and requires meow as a peer dependency.

error ERR_REQUIRE_ESM
cause Using require() to import an ESM-only package in v4.0.0.
fix
Replace const meowHelp = require('cli-meow-help') with import meowHelp from 'cli-meow-help'
error Cannot find module 'meow'
cause meow is not installed as a dependency.
fix
Run: npm install meow
error The 'defaults' option is no longer supported. Please remove it.
cause Using the deprecated 'defaults' option from v3 or earlier in v4.
fix
Remove the 'defaults' key from the options object passed to meowHelp().
breaking ESM-only since v4.0.0 – CommonJS require() will throw ERR_REQUIRE_ESM.
fix Switch to import statement: import meowHelp from 'cli-meow-help'
deprecated The 'defaults' option (boolean) was deprecated in v3.0.0 and removed in v4.0.0.
fix Remove the 'defaults' option from meowHelp() call.
deprecated The 'desc' option (string) is optional in v4.0.0; previously it was required.
fix Omit 'desc' if not needed, or pass as string.
gotcha Package requires meow as a peer dependency. Forgetting to install meow leads to import error.
fix Run: npm install meow
npm install cli-meow-help
yarn add cli-meow-help
pnpm add cli-meow-help

Demonstrates basic usage of cli-meow-help with meow: defines commands and flags, generates help text, and passes it to meow().

import meow from 'meow';
import meowHelp from 'cli-meow-help';

const commands = {
  new: { desc: 'Creates a new user account' },
  duplicate: { desc: 'Duplicates a user account' }
};

const flags = {
  random: { desc: 'Prints random data', type: 'boolean', default: true }
};

const helpText = meowHelp({
  name: 'cli-command',
  flags,
  commands
});

meow(helpText, { flags });

// Run `node cli.js --help` to see the auto-formatted help text.