Skip to content
Myr

Add outputHelp method to Command object.

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

authored by Karthik Viswanathan · committed by Karthik Viswanathan · parent 2aac48f · 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
969 unmodified lines
970971 again();972};973974975/**976 * Output help information for this command977 *978 * @api public979 */980981Command.prototype.outputHelp = function() {982 process.stdout.write(this.helpInformation());983 this.emit('--help');984}985986/**987 * Camel-case the given `flag`988 *989 * @param {String} flag990 * @return {String}
43 unmodified lines
1034function outputHelpIfNecessary(cmd, options) {1035 options = options || [];1036 for (var i = 0; i < options.length; i++) {1037 if (options[i] == '--help' || options[i] == '-h') {1026 process.stdout.write(cmd.helpInformation());1027 cmd.emit('--help');1038 cmd.outputHelp();1039 process.exit(0);1040 }1041 }1042}