Skip to content

Commit

Permalink
fix: load correct plugin when using dynamic help (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Mar 23, 2022
1 parent 5a4a27b commit 15c1fbe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/help/index.ts
Expand Up @@ -102,7 +102,7 @@ export class Help extends HelpBase {
const command = this.config.findCommand(subject)
if (command) {
if (command.hasDynamicHelp) {
const dynamicCommand = await toCached(await this.getDynamicCommand(command.id))
const dynamicCommand = await toCached(await this.getDynamicCommand(command))
await this.showCommandHelp(dynamicCommand)
} else {
await this.showCommandHelp(command)
Expand All @@ -128,12 +128,12 @@ export class Help extends HelpBase {
error(`Command ${subject} not found.`)
}

private async getDynamicCommand(cmdName: string): Promise<Interfaces.Command.Class> {
const plugin = new Plugin({ignoreManifest: true, root: this.config.root})
private async getDynamicCommand(command: Interfaces.Command.Plugin): Promise<Interfaces.Command.Class> {
const plugin = new Plugin({ignoreManifest: true, root: this.config.root, name: command.pluginName})
await plugin.load()
const cmd = await plugin.findCommand(cmdName)
const cmd = await plugin.findCommand(command.id)
if (!cmd) {
throw new Error(`Command ${cmdName} not found.`)
throw new Error(`Command ${command.id} not found.`)
}

return cmd
Expand Down

0 comments on commit 15c1fbe

Please sign in to comment.