Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

fix: use showCommandHelp to delegate topic help #58

Merged
merged 3 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ export default abstract class Command {
protected _help() {
const HHelp: typeof Help = require('@oclif/plugin-help').default
const help = new HHelp(this.config)
let title = this.ctor.description && help.render(this.ctor.description.trim()).split('\n')[0]
if (title) this.log(title + '\n')
this.log(help.command(Config.Command.toCached(this.ctor as any as Config.Command.Class)))
const cmd = Config.Command.toCached(this.ctor as any as Config.Command.Class)
if (!cmd.id) cmd.id = ''
help.showCommandHelp(cmd, this.config.topics)
return this.exit(0)
}

Expand Down
2 changes: 2 additions & 0 deletions test/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ USAGE

OPTIONS
--help show CLI help

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdxcode single-cli help didn't have a trailing newline

`)
})

Expand All @@ -257,6 +258,7 @@ OPTIONS

USAGE
$ @oclif/command

`)
})
})
Expand Down