Automatic help generation
This feature automatically generates help text for a specific command within an oclif CLI application. The help text includes the command's description, usage, arguments, flags, and examples.
const { Command, flags } = require('@oclif/command');
const Help = require('@oclif/plugin-help').default;
class MyCommand extends Command {
async run() {
// your command logic here
}
}
MyCommand.description = 'Description of my command';
const help = new Help(this.config);
help.showHelp(['mycommand']);
Custom help classes
Developers can extend the default Help class to create custom help output. This allows for greater control over the formatting and content of the help text displayed to the user.
const { Command } = require('@oclif/command');
const { Help } = require('@oclif/plugin-help');
class MyHelpClass extends Help {
// override methods to customize help output
}
class MyCommand extends Command {
static helpClass = MyHelpClass;
async run() {
// your command logic here
}
}