1 # meow [![Build Status](https://travis-ci.org/sindresorhus/meow.svg?branch=master)](https://travis-ci.org/sindresorhus/meow)
11 - Converts flags to [camelCase](https://github.com/sindresorhus/camelcase)
12 - Outputs version when `--version`
13 - Outputs description and supplied help text when `--help`
14 - Makes unhandled rejected promises [fail loudly](https://github.com/sindresorhus/loud-rejection) instead of the default silent fail
15 - Sets the process title to the binary name defined in package.json
28 $ ./foo-app.js unicorns --rainbow
34 const meow = require('meow');
35 const foo = require('.');
42 --rainbow, -r Include a rainbow
45 $ foo unicorns --rainbow
58 flags: {rainbow: true},
63 foo(cli.input[0], cli.flags);
69 ### meow(options, [minimistOptions])
71 Returns an `Object` with:
73 - `input` *(Array)* - Non-flag arguments
74 - `flags` *(Object)* - Flags converted to camelCase
75 - `pkg` *(Object)* - The `package.json` object
76 - `help` *(string)* - The help text used with `--help`
77 - `showHelp([code=2])` *(Function)* - Show the help text and exit with `code`
78 - `showVersion()` *(Function)* - Show the version text and exit
82 Type: `Object` `Array` `string`
84 Can either be a string/array that is the `help` or an options object.
90 Define argument flags.
92 The key is the flag name and the value is an object with any of:
94 - `type`: Type of value. (Possible values: `string` `boolean`)
95 - `alias`: Usually used to define a short flag alias.
96 - `default`: Default value when the flag is not specified.
113 Type: `string` `boolean`<br>
114 Default: The package.json `"description"` property
116 Description to show above the help text.
118 Set it to `false` to disable it altogether.
122 Type: `string` `boolean`
124 The help text you want shown.
126 The input is reindented and starting/ending newlines are trimmed which means you can use a [template literal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings) without having to care about using the correct amount of indent.
128 The description will be shown above your help text automatically.
132 Type: `string` `boolean`<br>
133 Default: The package.json `"version"` property
135 Set a custom version output.
142 Automatically show the help text when the `--help` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own help text.
149 Automatically show the version text when the `--version` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own version text.
154 Default: Closest package.json upwards
156 package.json as an `Object`.
158 *You most likely don't need this option.*
163 Default: `process.argv.slice(2)`
165 Custom arguments object.
172 Infer the argument type.
174 By default, the argument `5` in `$ foo 5` becomes a string. Enabling this would infer it as a number.
179 Meow will make unhandled rejected promises [fail loudly](https://github.com/sindresorhus/loud-rejection) instead of the default silent fail. Meaning you don't have to manually `.catch()` promises used in your CLI.
184 See [`chalk`](https://github.com/chalk/chalk) if you want to colorize the terminal output.
186 See [`get-stdin`](https://github.com/sindresorhus/get-stdin) if you want to accept input from stdin.
188 See [`conf`](https://github.com/sindresorhus/conf) if you need to persist some data.
190 See [`update-notifier`](https://github.com/yeoman/update-notifier) if you want update notifications.
192 [More useful CLI utilities…](https://github.com/sindresorhus/awesome-nodejs#command-line-utilities)
197 MIT © [Sindre Sorhus](https://sindresorhus.com)