Skip to content
Myr

Merge pull request #86 from karthikv/output-help

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Add outputHelp method to Command object.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 6092d8e, a42471a · Browse files · 1 file+13 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−2 removed

  • other:+13 added−2 removed

1 file+13 added−2 removed

modified:lib/commander.js+13 added-2 removed
980 unmodified lines
981982 again();983};984985986/**987 * Output help information for this command988 *989 * @api public990 */991992Command.prototype.outputHelp = function() {993 process.stdout.write(this.helpInformation());994 this.emit('--help');995}996997/**998 * Camel-case the given `flag`999 *1000 * @param {String} flag1001 * @return {String}
43 unmodified lines
1045function outputHelpIfNecessary(cmd, options) {1046 options = options || [];1047 for (var i = 0; i < options.length; i++) {1048 if (options[i] == '--help' || options[i] == '-h') {1037 process.stdout.write(cmd.helpInformation());1038 cmd.emit('--help');1049 cmd.outputHelp();1050 process.exit(0);1051 }1052 }1053}