Skip to content

Commit c80321d

Browse files
committed
drop support for using an array in the help option
Just use a template literal instead.
1 parent 578733e commit c80321d

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ module.exports = (opts, minimistOpts) => {
4141
minimistOpts.string.splice(index, 1);
4242
}
4343

44-
if (Array.isArray(opts.help)) {
45-
opts.help = opts.help.join('\n');
46-
}
47-
4844
const pkg = typeof opts.pkg === 'string' ? require(path.join(parentDir, opts.pkg)) : opts.pkg;
4945
const argv = minimist(opts.argv, minimistOpts);
5046
let help = redent(trimNewlines((opts.help || '').replace(/\t+\n*$/, '')), 2);

readme.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ The help text you want shown.
9696

9797
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.
9898

99-
<del>If it's an array each item will be a line.</del><br>
100-
*(Still supported, but you should use a template literal instead.)*
101-
10299
The description will be shown above your help text automatically.
103100

104101
Set it to `false` to disable it altogether.

test.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ global.Promise = Promise;
99
test('return object', t => {
1010
const cli = m({
1111
argv: ['foo', '--foo-bar', '-u', 'cat', '--', 'unicorn', 'cake'],
12-
help: [
13-
'Usage',
14-
' foo <input>'
15-
]
12+
help: `
13+
Usage
14+
foo <input>
15+
`
1616
}, {
1717
'alias': {u: 'unicorn'},
1818
'default': {meow: 'dog'},
@@ -29,7 +29,10 @@ test('return object', t => {
2929
});
3030

3131
test('support help shortcut', t => {
32-
const cli = m(['unicorn', 'cat']);
32+
const cli = m(`
33+
unicorn
34+
cat
35+
`);
3336
t.is(cli.help, indentString('\nCLI app helper\n\nunicorn\ncat\n', 2));
3437
});
3538

0 commit comments

Comments
 (0)