Skip to content

Commit 439ac9b

Browse files
committed
Fix docs regarding meow arguments
1 parent cd635d4 commit 439ac9b

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const normalizePackageData = require('normalize-package-data');
1414
delete require.cache[__filename];
1515
const parentDir = path.dirname(module.parent.filename);
1616

17-
module.exports = (helpMessage, options) => {
18-
if (typeof helpMessage === 'object' && !Array.isArray(helpMessage)) {
19-
options = helpMessage;
20-
helpMessage = '';
17+
module.exports = (helpText, options) => {
18+
if (typeof helpText !== 'string') {
19+
options = helpText;
20+
helpText = '';
2121
}
2222

2323
options = {
@@ -28,7 +28,7 @@ module.exports = (helpMessage, options) => {
2828
argv: process.argv.slice(2),
2929
inferType: false,
3030
input: 'string',
31-
help: helpMessage,
31+
help: helpText,
3232
autoHelp: true,
3333
autoVersion: true,
3434
booleanDefault: false,

readme.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ foo(cli.input[0], cli.flags);
6767

6868
## API
6969

70-
### meow(options, [minimistOptions])
70+
### meow(helpText, [options])
71+
### meow(options)
7172

7273
Returns an `Object` with:
7374

@@ -78,11 +79,15 @@ Returns an `Object` with:
7879
- `showHelp([code=2])` *(Function)* - Show the help text and exit with `code`
7980
- `showVersion()` *(Function)* - Show the version text and exit
8081

81-
#### options
82+
#### helpText
83+
84+
Type: `string`
8285

83-
Type: `Object` `Array` `string`
86+
Shortcut for the `help` option.
8487

85-
Can either be a string/array that is the `help` or an options object.
88+
#### options
89+
90+
Type: `Object`
8691

8792
##### flags
8893

test.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ test('type inference', t => {
107107
});
108108

109109
test('booleanDefault: undefined, filter out unset boolean args', t => {
110-
t.deepEqual(meow('help', {
110+
t.deepEqual(meow({
111111
argv: ['--foo'],
112112
booleanDefault: undefined,
113113
flags: {
@@ -129,7 +129,7 @@ test('booleanDefault: undefined, filter out unset boolean args', t => {
129129
});
130130

131131
test('boolean args are false by default', t => {
132-
t.deepEqual(meow('help', {
132+
t.deepEqual(meow({
133133
argv: ['--foo'],
134134
flags: {
135135
foo: {
@@ -151,17 +151,19 @@ test('boolean args are false by default', t => {
151151
});
152152

153153
test('enforces boolean flag type', t => {
154-
const cli = meow('', {
154+
const cli = meow({
155155
argv: ['--cursor=false'],
156156
flags: {
157-
cursor: {type: 'boolean'}
157+
cursor: {
158+
type: 'boolean'
159+
}
158160
}
159161
});
160162
t.deepEqual(cli.flags, {cursor: false});
161163
});
162164

163165
test('accept help and options', t => {
164-
t.deepEqual(meow('help', {
166+
t.deepEqual(meow({
165167
argv: ['-f'],
166168
flags: {
167169
foo: {

0 commit comments

Comments
 (0)