Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dont assume plugin-help is installed #975

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading