Skip to content

Add helpInformation to typings#992

Closed
jharrilim wants to merge 1 commit intotj:masterfrom
jharrilim:master
Closed

Add helpInformation to typings#992
jharrilim wants to merge 1 commit intotj:masterfrom
jharrilim:master

Conversation

@jharrilim
Copy link
Copy Markdown

Missing type for Commander.prototype.helpInformation:

commander.js/index.js

Lines 1085 to 1129 in 1c1ffca

Command.prototype.helpInformation = function() {
var desc = [];
if (this._description) {
desc = [
this._description,
''
];
var argsDescription = this._argsDescription;
if (argsDescription && this._args.length) {
var width = this.padWidth();
desc.push('Arguments:');
desc.push('');
this._args.forEach(function(arg) {
desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);
});
desc.push('');
}
}
var cmdName = this._name;
if (this._alias) {
cmdName = cmdName + '|' + this._alias;
}
var usage = [
'Usage: ' + cmdName + ' ' + this.usage(),
''
];
var cmds = [];
var commandHelp = this.commandHelp();
if (commandHelp) cmds = [commandHelp];
var options = [
'Options:',
'' + this.optionHelp().replace(/^/gm, ' '),
''
];
return usage
.concat(desc)
.concat(options)
.concat(cmds)
.join('\n');
};

@shadowspawn
Copy link
Copy Markdown
Collaborator

This is as intended since helpInformation is marked in the JSDoc with @api private. We do not document the private api calls in the TypeScript.

@jharrilim
Copy link
Copy Markdown
Author

Ok makes sense. I was thinking maybe it should be declared as public so that I may get the string and not always write to stdout (perhaps another stream), but maybe I am designing my program wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants