diff --git a/src/help/index.ts b/src/help/index.ts index ba373de98..6e32be751 100644 --- a/src/help/index.ts +++ b/src/help/index.ts @@ -90,6 +90,8 @@ export class Help extends HelpBase { } public async showHelp(argv: string[]) { + argv = argv.filter(arg => !getHelpFlagAdditions(this.config).includes(arg)) + if (this.config.topicSeparator !== ':') argv = standardizeIDFromArgv(argv, this.config) const subject = getHelpSubject(argv, this.config) if (!subject) { @@ -202,10 +204,14 @@ export class Help extends HelpBase { command.id = command.id.replace(/:/g, this.config.topicSeparator) command.aliases = command.aliases && command.aliases.map(a => a.replace(/:/g, this.config.topicSeparator)) } - const help = new this.CommandHelpClass(command, this.config, this.opts) + const help = this.getCommandHelpClass(command) return help.generate() } + protected getCommandHelpClass(command: Interfaces.Command) { + return new this.CommandHelpClass(command, this.config, this.opts) + } + protected formatCommands(commands: Interfaces.Command[]): string { if (commands.length === 0) return '' diff --git a/src/main.ts b/src/main.ts index 822febd29..ba30fe8ec 100644 --- a/src/main.ts +++ b/src/main.ts @@ -51,7 +51,6 @@ export async function run(argv = process.argv.slice(2), options?: Interfaces.Loa // display help version if applicable if (helpAddition(argv, config)) { - argv = argv.filter(arg => !getHelpFlagAdditions(config).includes(arg)) const Help = await loadHelpClass(config) const help = new Help(config, config.pjson.helpOptions) await help.showHelp(argv)