Skip to content

Commit

Permalink
fix: only show topics 1 level deep
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 17, 2018
1 parent 5af8a0b commit 829e75e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class Help {
} else if (command = this.config.findCommand(subject)) {
const name = command.id
const depth = name.split(':').length
topics = topics.filter(t => t.name.startsWith(name) && t.name.split(':').length === depth + 1)
topics = topics.filter(t => t.name.startsWith(name + ':') && t.name.split(':').length === depth + 1)
let title = command.description && this.render(command.description).split('\n')[0]
if (title) console.log(title + '\n')
console.log(this.command(command))
Expand All @@ -73,7 +73,7 @@ export default class Help {
} else if (topic = this.config.findTopic(subject)) {
const name = topic.name
const depth = name.split(':').length
topics = topics.filter(t => t.name.startsWith(name) && t.name.split(':').length === depth + 1)
topics = topics.filter(t => t.name.startsWith(name + ':') && t.name.split(':').length === depth + 1)
console.log(this.topic(topic))
if (topics.length) {
console.log(this.topics(topics))
Expand Down

0 comments on commit 829e75e

Please sign in to comment.