Skip to content

Commit 93f19fc

Browse files
committed
feat(readme command): Add --shallow and --sort-order to options for readme command
1 parent 436bfcb commit 93f19fc

File tree

1 file changed

+54
-34
lines changed

1 file changed

+54
-34
lines changed

src/commands/readme.js

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/* @flow */
22

3-
var fs = require('fs');
4-
var remark = require('remark');
5-
var path = require('path');
6-
var documentation = require('../');
7-
var inject = require('mdast-util-inject');
8-
var chalk = require('chalk');
9-
var disparity = require('disparity');
3+
var path = require('path'),
4+
fs = require('fs'),
5+
remark = require('remark'),
6+
inject = require('mdast-util-inject'),
7+
chalk = require('chalk'),
8+
disparity = require('disparity'),
9+
documentation = require('../'),
10+
_ = require('lodash');
1011

1112
module.exports.command = 'readme [input..]';
1213
module.exports.description = 'inject documentation into your README.md';
@@ -16,34 +17,53 @@ module.exports.description = 'inject documentation into your README.md';
1617
* @returns {Object} yargs with options
1718
* @private
1819
*/
19-
module.exports.builder = {
20-
usage:
21-
'Usage: documentation readme [--readme-file=README.md] --section "API"' +
22-
' [--compare-only] [other documentationjs options]',
23-
example: 'documentation readme index.js -s "API Docs" --github',
24-
'readme-file': {
25-
describe: 'The markdown file into which to inject documentation',
26-
default: 'README.md'
27-
},
28-
section: {
29-
alias: 's',
30-
describe:
31-
'The section heading after which to inject generated documentation',
32-
required: true
33-
},
34-
'diff-only': {
35-
alias: 'd',
36-
describe:
37-
'Instead of updating the given README with the generated documentation,' +
38-
' just check if its contents match, exiting nonzero if not.',
39-
default: false
40-
},
41-
quiet: {
42-
alias: 'q',
43-
describe: 'Quiet mode: do not print messages or README diff to stdout.',
44-
default: false
20+
module.exports.builder = _.assign(
21+
{},
22+
{
23+
usage:
24+
'Usage: documentation readme [--readme-file=README.md] --section "API"' +
25+
' [--compare-only] [other documentationjs options]',
26+
example: 'documentation readme index.js -s "API Docs" --github',
27+
'readme-file': {
28+
describe: 'The markdown file into which to inject documentation',
29+
default: 'README.md',
30+
type: 'string'
31+
},
32+
section: {
33+
alias: 's',
34+
describe:
35+
'The section heading after which to inject generated documentation',
36+
required: true,
37+
type: 'string'
38+
},
39+
'diff-only': {
40+
alias: 'd',
41+
describe:
42+
'Instead of updating the given README with the generated documentation,' +
43+
' just check if its contents match, exiting nonzero if not.',
44+
default: false,
45+
type: 'boolean'
46+
},
47+
quiet: {
48+
alias: 'q',
49+
describe: 'Quiet mode: do not print messages or README diff to stdout.',
50+
default: false,
51+
type: 'boolean'
52+
},
53+
shallow: {
54+
describe:
55+
'shallow mode turns off dependency resolution, ' +
56+
'only processing the specified files (or the main script specified in package.json)',
57+
default: false,
58+
type: 'boolean'
59+
},
60+
'sort-order': {
61+
describe: 'The order to sort the documentation',
62+
choices: ['source', 'alpha'],
63+
default: 'source'
64+
}
4565
}
46-
};
66+
);
4767

4868
/**
4969
* Insert API documentation into a Markdown readme

0 commit comments

Comments
 (0)