@oclif/plugin-help
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -1,1 +0,1 @@ | ||
{"version":"1.1.1","commands":{"commands":{"id":"commands","pluginName":"@oclif/plugin-help","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"help":{"id":"help","description":"display help for <%= config.bin %>","pluginName":"@oclif/plugin-help","pluginType":"core","aliases":[],"flags":{"all":{"name":"all","type":"boolean","description":"see all commands in CLI"}},"args":[{"name":"command","description":"command to show help for","required":false}]}}} | ||
{"version":"1.1.2","commands":{"commands":{"id":"commands","pluginName":"@oclif/plugin-help","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"help":{"id":"help","description":"display help for <%= config.bin %>","pluginName":"@oclif/plugin-help","pluginType":"core","aliases":[],"flags":{"all":{"name":"all","type":"boolean","description":"see all commands in CLI"}},"args":[{"name":"command","description":"command to show help for","required":false}]}}} |
@@ -0,1 +1,9 @@ | ||
<a name="1.1.2"></a> | ||
## [1.1.2](https://github.com/oclif/plugin-help/compare/165a53c8d7f6705b20fa56553e6d78cb689d882e...v1.1.2) (2018-02-17) | ||
### Bug Fixes | ||
* use topics only ([81c089f](https://github.com/oclif/plugin-help/commit/81c089f)) | ||
<a name="1.1.1"></a> | ||
@@ -2,0 +10,0 @@ ## [1.1.1](https://github.com/oclif/plugin-help/compare/67d1cba010649852ecbd1b6870e91e06df35aa28...v1.1.1) (2018-02-17) |
@@ -16,3 +16,3 @@ import * as Config from '@oclif/config'; | ||
command(command: Config.Command): string; | ||
commands(commands: (Config.Command | Config.Topic)[]): string | undefined; | ||
topics(topics: Config.Topic[]): string | undefined; | ||
} |
@@ -37,6 +37,4 @@ "use strict"; | ||
let topics = this.config.topics; | ||
let commands = this.config.commands; | ||
commands = commands.filter(c => this.opts.all || !c.hidden); | ||
commands = util_1.sortBy(commands, c => c.id); | ||
commands = util_1.uniqBy(commands, c => c.id); | ||
topics = util_1.sortBy(topics, t => t.name); | ||
topics = util_1.uniqBy(topics, t => t.name); | ||
let subject = getHelpSubject(); | ||
@@ -49,13 +47,10 @@ let command; | ||
if (!this.opts.all) { | ||
commands = commands.filter(c => !c.id.includes(':')); | ||
topics = topics.filter(t => !t.name.includes(':')); | ||
} | ||
console.log(this.commands([...topics, ...commands])); | ||
console.log(this.topics(topics)); | ||
console.log(); | ||
} | ||
else if (command = this.config.findCommand(subject)) { | ||
const id = command.id; | ||
const depth = id.split(':').length; | ||
commands = commands.filter(c => c.id.startsWith(id) && c.id.split(':').length === depth + 1); | ||
topics = topics.filter(t => t.name.startsWith(id) && t.name.split(':').length === depth + 1); | ||
const name = command.id; | ||
topics = topics.filter(t => t.name.startsWith(name + ':')); | ||
let title = command.description && this.render(command.description).split('\n')[0]; | ||
@@ -66,4 +61,4 @@ if (title) | ||
console.log(); | ||
if (commands.length) { | ||
console.log(this.commands(commands)); | ||
if (topics.length) { | ||
console.log(this.topics(topics)); | ||
console.log(); | ||
@@ -73,6 +68,7 @@ } | ||
else if (topic = this.config.findTopic(subject)) { | ||
const name = topic.name; | ||
console.log(this.topic(topic)); | ||
commands = commands.filter(c => c.id.startsWith(topic.name)); | ||
if (commands.length) { | ||
console.log(this.commands(commands)); | ||
topics = topics.filter(t => t.name.startsWith(name + ':')); | ||
if (topics.length) { | ||
console.log(this.topics(topics)); | ||
console.log(); | ||
@@ -112,9 +108,7 @@ } | ||
} | ||
commands(commands) { | ||
if (!commands.length) | ||
topics(topics) { | ||
if (!topics.length) | ||
return; | ||
commands = util_1.uniqBy(commands, id); | ||
commands = util_1.sortBy(commands, id); | ||
let body = list_1.renderList(commands.map(c => [ | ||
id(c), | ||
let body = list_1.renderList(topics.map(c => [ | ||
c.name, | ||
c.description && this.render(c.description.split('\n')[0]) | ||
@@ -129,4 +123,4 @@ ]), { stripAnsi: this.opts.stripAnsi, maxWidth: this.opts.maxWidth - 2 }); | ||
exports.default = Help; | ||
function id(c) { | ||
return c.id || c.name; | ||
} | ||
// function id(c: Config.Command | Config.Topic): string { | ||
// return (c as any).id || (c as any).name | ||
// } |
{ | ||
"name": "@oclif/plugin-help", | ||
"description": "standard help for oclif", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -17,3 +17,3 @@ "bugs": "https://github.com/oclif/plugin-help/issues", | ||
"devDependencies": { | ||
"@oclif/config": "^1.3.56", | ||
"@oclif/config": "^1.3.57", | ||
"@oclif/dev-cli": "^1.2.16", | ||
@@ -20,0 +20,0 @@ "@oclif/errors": "^1.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35431
561