JSPM

  • Created
  • Published
  • Downloads 26758827
  • Score
    100M100P100Q211041F
  • License MIT

CLI app helper

Package Exports

  • meow

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (meow) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

meow Build Status

CLI app helper

Features

  • Parses arguments using minimist
  • Converts flags to camelCase
  • Outputs version when --version
  • Outputs description and supplied help text when --help
  • Outputs the above when no input is supplied (can be disabled)

Install

$ npm install --save meow

Usage

$ ./foo-app.js unicorns --rainbow-cake
#!/usr/bin/env node
'use strict';
var meow = require('meow');
var fooApp = require('./');

var cli = meow({
    help: [
        'Usage',
        '  foo-app <input>'
    ].join('\n')
});
/*
{
    input: ['unicorns'],
    flags: {rainbowCake: true},
    pkg: {
        name: 'foo-app',
        ...
}
*/

fooApp(cli.input[0], cli.flags);

API

meow(options, minimistOptions)

Returns an object with:

  • input (array) - Non-flag arguments
  • flags (object) - Flags converted to camelCase
  • pkg (object) - The package.json object

options

help

Type: string

The help text you want shown.

pkg

Type: string
Default: package.json

Relative path to package.json.

requireInput

Type: boolean
Default: true

Require there to be at least one input argument.

argv

Type: array
Default: process.argv.slice(2)

Custom arguments object.

minimistOptions

Type: object
Default: {}

Minimist options.

License

MIT © Sindre Sorhus