CLI app helper
--version
--help
$ npm install --save meow
$ ./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>'
]
});
/*
{
input: ['unicorns'],
flags: {rainbowCake: true},
...
}
*/
fooApp(cli.input[0], cli.flags);
Returns an object with:
input
(array) - Non-flag argumentsflags
(object) - Flags converted to camelCasepkg
(object) - The package.json
objecthelp
(object) - The help text used with --help
showHelp()
(function) - Show the help text and exitType: array
, string
, boolean
The help text you want shown.
If it's an array each item will be a line.
If you don't specify anything, it will still show the package.json "description"
.
Set it to false
to disable it all together.
Type: string
, boolean
Default: the package.json "version"
property
Set a custom version output.
Set it to false
to disable it all together.
Type: string
, object
Default: package.json
Relative path to package.json
or it as an object.
Type: array
Default: process.argv.slice(2)
Custom arguments object.
Type: object
Default: {}
Minimist options.
Use get-stdin if you need to accept input from stdin.
MIT © Sindre Sorhus