Skip to content

Commit

Permalink
Merge pull request #975 from oclif/mdonnalley/use-help-class
Browse files Browse the repository at this point in the history
fix: dont assume plugin-help is installed
  • Loading branch information
shetzel authored Feb 26, 2024
2 parents 2edb16c + 35acf97 commit 8cf6828
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export async function run(argv?: string[], options?: Interfaces.LoadOptions): Pr
Performance.debug()
}

const showHelp = async (argv: string[]) => {
const Help = await loadHelpClass(config)
const help = new Help(config, config.pjson.oclif.helpOptions ?? config.pjson.helpOptions)
await help.showHelp(argv)
}

debug(`process.execPath: ${process.execPath}`)
debug(`process.execArgv: ${process.execArgv}`)
debug('process.argv: %O', process.argv)
Expand All @@ -63,9 +69,7 @@ export async function run(argv?: string[], options?: Interfaces.LoadOptions): Pr

// display help version if applicable
if (helpAddition(argv, config)) {
const Help = await loadHelpClass(config)
const help = new Help(config, config.pjson.oclif.helpOptions ?? config.pjson.helpOptions)
await help.showHelp(argv)
await showHelp(argv)
await collectPerf()
return
}
Expand All @@ -74,7 +78,12 @@ export async function run(argv?: string[], options?: Interfaces.LoadOptions): Pr
const cmd = config.findCommand(id)
if (!cmd) {
const topic = config.flexibleTaxonomy ? null : config.findTopic(id)
if (topic) return config.runCommand('help', [id])
if (topic) {
await showHelp([id])
await collectPerf()
return
}

if (config.pjson.oclif.default) {
id = config.pjson.oclif.default
argvSlice = argv
Expand Down

0 comments on commit 8cf6828

Please sign in to comment.