Skip to Content
🎉 Hyperse Wizard has been published.

Help Plugin

The Help Plugin provides comprehensive help information for CLI applications built with Wizard.

Installation

npm install @hyperse/wizard-plugin-help

Quick Start

cli.ts
import { createWizard, defineCommand, definePlugin } from '@hyperse/wizard'; import { createHelpPlugin } from '@hyperse/wizard-plugin-help'; const evolve = defineCommand('evolve', { description: 'plugins.evolvePlugin.description', }).flags({ evolveName: { type: String, default: 'evolveName', description: 'plugins.evolvePlugin.flags.evolveName', }, }); const migrate = defineCommand('migrate', { description: 'plugins.migratePlugin.description', }).flags({ migrateName: { type: String, default: 'evolveName', description: 'plugins.migratePlugin.flags.migrateName', }, }); const cli = createWizard({ name: 'hps_cli', description: 'cli.helpCli.description', version: 'cli.helpCli.version', localeMessages: helpCliMessages, errorHandler: (e) => { console.log('CLI errorHandler \n', e); }, }) .use( createHelpPlugin({ showBanner: true, showFooter: true, overrideLocaleMessages: { en: { helpPlugin: { banner: '🎉🎉🎉Wizard cli is published by hps🎉🎉🎉', footer: '@2025 wizard-plugin-help English version', }, }, zh: { helpPlugin: { banner: '🎉🎉🎉Wizard cli 正在发布🎉🎉🎉', footer: '@2025 wizard-plugin-help 中文版本', }, }, }, }) ) .use( definePlugin({ name: () => 'test plugin', localeMessages: buildPluginMessages, setup: (cli) => { return cli.register( defineCommand('build', { description: 'plugins.buildPlugin.description', example: 'plugins.buildPlugin.example', help: 'plugins.buildPlugin.help', }) .flags({ projectCwd: { type: String, default: 'projectCwd', alias: 'p', description: 'plugins.buildPlugin.flags.projectCwd', }, type: { type: Boolean, alias: 't', required: true, default: true, description: 'plugins.buildPlugin.flags.type', }, timeout: { type: Number, description: 'plugins.buildPlugin.flags.timeout', }, }) .use(evolve, migrate) ); }, }) ) .flag('version', { type: Boolean, default: false, alias: 'V', description: 'plugins.versionPlugin.description', }); // execute command // node ./cli.js -h
  • English

help

  • Chinese

help

API Reference

Parameters:
NameTypeDefault
optionsHelpPluginOptions
Returns:
Plugin<CommandNameToContext, MergeCommandNameToContext<CommandNameToContext, { help: object; }>, Flags>
  • HelpPluginOptions
NameTypeDefault
flagboolean

Whether to register the global help flag (-h/—help).

If true, the -h/—help flag will be automatically added to all commands, allowing users to display help information via the flag. If false, the flag will not be registered and users must invoke the help command manually.

true
showBannerboolean

Whether to display the banner text at the top of the help message.

If true, must provide the banner text via the overrideLocaleMessages option.

false
showFooterboolean

Whether to display the footer text at the bottom of the help message.

If true, must provide the footer text via the overrideLocaleMessages option.

false
overrideLocaleMessagesDeepPartial<HelpPluginLocaleOverrideMessages>

Override locale messages.

{}
Last updated on