From 829e75edaf307223a1693b16d10e2216e0f5f9ba Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Sat, 17 Feb 2018 01:56:35 -0800 Subject: [PATCH] fix: only show topics 1 level deep --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index eb508589..b47c85ac 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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)) @@ -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))