This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

Meow CLI Helper Cheatsheet

A quick reference guide for Meow: minimalist CLI helper for Node.js, option definitions, flag types, camelCase conversion, and help text.

· Published

meow is a lightweight CLI helper for Node.js that parses flags and outputs clean --help and --version messages.

Basic Setup

const meow = require('meow');

const cli = meow(`
  Usage:
    $ mycli [input] [options]

  Options:
    --lang, -l     Specify preferred language (default: en)
    --verbose, -v  Enable debug log output
    --help, -h     Show this help screen
    --version      Print version and exit

  Examples:
    $ mycli index.js --lang es
`, {
  flags: {
    lang: {
      type: 'string',
      shortFlag: 'l',
      default: 'en'
    },
    verbose: {
      type: 'boolean',
      shortFlag: 'v'
    }
  }
});

Accessing Parsed Output

// Parsed flags (automatically normalized to camelCase)
console.log(cli.flags);
// => { lang: 'en', verbose: true }

// Positional non-flag arguments
console.log(cli.input);
// => ['index.js']

// Display help screen and exit
cli.showHelp();

Configuration Options

Option Type Description
flags Object Map of flag names and their types (string, boolean, number)
autoHelp Boolean Automatically intercept --help (default: true)
autoVersion Boolean Automatically intercept --version (default: true)
description String Override package.json description
allowUnknownFlags Boolean Allow flags not defined in the flags schema

References

Related topics