Skip to content

Add --shallow and --sort-order to options for readme command #953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 54 additions & 34 deletions src/commands/readme.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* @flow */

var fs = require('fs');
var remark = require('remark');
var path = require('path');
var documentation = require('../');
var inject = require('mdast-util-inject');
var chalk = require('chalk');
var disparity = require('disparity');
var path = require('path'),
fs = require('fs'),
remark = require('remark'),
inject = require('mdast-util-inject'),
chalk = require('chalk'),
disparity = require('disparity'),
documentation = require('../'),
_ = require('lodash');

module.exports.command = 'readme [input..]';
module.exports.description = 'inject documentation into your README.md';
Expand All @@ -16,34 +17,53 @@ module.exports.description = 'inject documentation into your README.md';
* @returns {Object} yargs with options
* @private
*/
module.exports.builder = {
usage:
'Usage: documentation readme [--readme-file=README.md] --section "API"' +
' [--compare-only] [other documentationjs options]',
example: 'documentation readme index.js -s "API Docs" --github',
'readme-file': {
describe: 'The markdown file into which to inject documentation',
default: 'README.md'
},
section: {
alias: 's',
describe:
'The section heading after which to inject generated documentation',
required: true
},
'diff-only': {
alias: 'd',
describe:
'Instead of updating the given README with the generated documentation,' +
' just check if its contents match, exiting nonzero if not.',
default: false
},
quiet: {
alias: 'q',
describe: 'Quiet mode: do not print messages or README diff to stdout.',
default: false
module.exports.builder = _.assign(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use lodash here?

{},
{
usage:
'Usage: documentation readme [--readme-file=README.md] --section "API"' +
' [--compare-only] [other documentationjs options]',
example: 'documentation readme index.js -s "API Docs" --github',
'readme-file': {
describe: 'The markdown file into which to inject documentation',
default: 'README.md',
type: 'string'
},
section: {
alias: 's',
describe:
'The section heading after which to inject generated documentation',
required: true,
type: 'string'
},
'diff-only': {
alias: 'd',
describe:
'Instead of updating the given README with the generated documentation,' +
' just check if its contents match, exiting nonzero if not.',
default: false,
type: 'boolean'
},
quiet: {
alias: 'q',
describe: 'Quiet mode: do not print messages or README diff to stdout.',
default: false,
type: 'boolean'
},
shallow: {
describe:
'shallow mode turns off dependency resolution, ' +
'only processing the specified files (or the main script specified in package.json)',
default: false,
type: 'boolean'
},
'sort-order': {
describe: 'The order to sort the documentation',
choices: ['source', 'alpha'],
default: 'source'
}
}
};
);

/**
* Insert API documentation into a Markdown readme
Expand Down