Skip to content

Commit

Permalink
fix: fixed topic list
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 6, 2018
1 parent b42fde4 commit 61a26af
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 63 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"bugs": "https://github.com/anycli/plugin-help/issues",
"dependencies": {
"@anycli/command": "^1.2.10",
"@anycli/command": "^1.2.13",
"chalk": "^2.3.0",
"indent-string": "^3.2.0",
"lodash.template": "^4.4.0",
Expand All @@ -27,7 +27,7 @@
"wrap-ansi": "^3.0.1"
},
"devDependencies": {
"@anycli/config": "^1.3.16",
"@anycli/config": "^1.3.19",
"@anycli/dev-cli": "^0.2.2",
"@anycli/errors": "^0.2.1",
"@anycli/plugin-legacy": "^0.0.3",
Expand Down
1 change: 0 additions & 1 deletion src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default class CommandHelp {
}), f => [!f.char, f.char, f.name])
const args = (cmd.args || []).filter(a => !a.hidden)
let output = compact([
cmd.description && this.render(cmd.description).split('\n')[0],
this.usage(cmd, flags),
this.args(args),
this.flags(flags),
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export default class Help {
}
} else if (command = this.config.findCommand(subject)) {
commands = commands.filter(c => c.id !== command!.id && c.id.startsWith(command!.id))
let title = command.description && this.render(command.description).split('\n')[0]
if (title) console.log(title + '\n')
console.log(this.command(command))
console.log()
if (commands.length) {
Expand Down
12 changes: 3 additions & 9 deletions test/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ multiline help`
ss: flags.boolean({description: 'newliney\n'.repeat(4)}),
remote: flags.string({char: 'r'}),
}})
.it('shows lots of output', ctx => expect(ctx.commandHelp).to.equal(`first line
USAGE
.it('shows lots of output', ctx => expect(ctx.commandHelp).to.equal(`USAGE
$ anycli apps:create [APP_NAME] [OPTIONS]
ARGUMENTS
Expand Down Expand Up @@ -84,9 +82,7 @@ ALIASES
ss: flags.boolean({description: 'newliney\n'.repeat(5)}),
remote: flags.string({char: 'r'}),
}})
.it('shows alternate output when many lines', ctx => expect(ctx.commandHelp).to.equal(`description of apps:create
USAGE
.it('shows alternate output when many lines', ctx => expect(ctx.commandHelp).to.equal(`USAGE
$ anycli apps:create [APP_NAME] [OPTIONS]
ARGUMENTS
Expand Down Expand Up @@ -125,9 +121,7 @@ ALIASES
static flags = {
force: flags.boolean({description: 'forces'}),
}})
.it('outputs with description', ctx => expect(ctx.commandHelp).to.equal(`description of apps:create
USAGE
.it('outputs with description', ctx => expect(ctx.commandHelp).to.equal(`USAGE
$ anycli apps:create [APP_NAME] [OPTIONS]
ARGUMENTS
Expand Down
79 changes: 28 additions & 51 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@
# yarn lockfile v1


"@anycli/command@^1.2.10":
version "1.2.10"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.10.tgz#6870c79a531513a31cdd12abd45f0cd2d4322b4b"
"@anycli/command@^1.2.10", "@anycli/command@^1.2.9":
version "1.2.12"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.12.tgz#9f2dc465414637b0e16fdf6afc7ac17a856d31de"
dependencies:
"@anycli/parser" "^3.2.6"

"@anycli/command@^1.2.9":
version "1.2.9"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.9.tgz#6db08fbb3537c8cc2f616415fcd6360043750f38"
"@anycli/command@^1.2.13":
version "1.2.13"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.13.tgz#2c3470a3f3b952aa42dd1b2491de85e116c28ae0"
dependencies:
"@anycli/parser" "^3.2.5"

"@anycli/config@^1.3.10":
version "1.3.10"
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.3.10.tgz#8d821fe8a60ec400dd49d9b1a12f7062e590dd4f"
"@anycli/parser" "^3.2.6"

"@anycli/config@^1.3.16":
version "1.3.16"
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.3.16.tgz#7157649932c7c90450e32cf685ce295f2faa069a"
"@anycli/config@^1.3.10", "@anycli/config@^1.3.19":
version "1.3.19"
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.3.19.tgz#e4fe2a21fbb542d329d1be5e5612bc2c21722e5b"

"@anycli/dev-cli@^0.2.2":
version "0.2.2"
Expand All @@ -31,17 +27,7 @@
"@anycli/errors" "^0.2.0"
"@anycli/plugin-help" "^0.6.4"

"@anycli/errors@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@anycli/errors/-/errors-0.2.0.tgz#ee421115dcdb499d76de9d4853718c06e1c5d5f0"
dependencies:
clean-stack "^1.3.0"
fs-extra "^5.0.0"
indent-string "^3.2.0"
strip-ansi "^4.0.0"
wrap-ansi "^3.0.1"

"@anycli/errors@^0.2.1":
"@anycli/errors@^0.2.0", "@anycli/errors@^0.2.1":
version "0.2.1"
resolved "https://registry.yarnpkg.com/@anycli/errors/-/errors-0.2.1.tgz#719a95cd9c23838c65929da5d625a7537dd7d035"
dependencies:
Expand All @@ -51,19 +37,15 @@
strip-ansi "^4.0.0"
wrap-ansi "^3.0.1"

"@anycli/parser@^3.2.5":
version "3.2.5"
resolved "https://registry.yarnpkg.com/@anycli/parser/-/parser-3.2.5.tgz#d0e7ddb14945cb84377fa69095009ca6005e6b6d"

"@anycli/parser@^3.2.6":
version "3.2.6"
resolved "https://registry.yarnpkg.com/@anycli/parser/-/parser-3.2.6.tgz#bbd119a80709099179a9f11af0dc44b68c54575b"

"@anycli/plugin-help@^0.6.4":
version "0.6.4"
resolved "https://registry.yarnpkg.com/@anycli/plugin-help/-/plugin-help-0.6.4.tgz#ae3d6b4663b0fd6f7e3e78a2bc11fc41c7f8bb17"
version "0.6.7"
resolved "https://registry.yarnpkg.com/@anycli/plugin-help/-/plugin-help-0.6.7.tgz#c534a6677cb02d427b2fcb4e8d487c76a92f029a"
dependencies:
"@anycli/command" "^1.2.9"
"@anycli/command" "^1.2.10"
chalk "^2.3.0"
indent-string "^3.2.0"
lodash.template "^4.4.0"
Expand Down Expand Up @@ -154,8 +136,8 @@
"@types/lodash" "*"

"@types/lodash@*":
version "4.14.100"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.100.tgz#f353dd9d3a9785638b6cb8023e6639097bd31969"
version "4.14.101"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.101.tgz#512f6c9e1749890f4d024e98cb995a63f562d458"

"@types/mocha@^2.2.48":
version "2.2.48"
Expand Down Expand Up @@ -358,8 +340,8 @@ commander@2.6.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d"

commander@^2.12.1:
version "2.13.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
version "2.14.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.0.tgz#7b25325963e6aace20d3a9285b09379b0c2208b5"

concat-map@0.0.1:
version "0.0.1"
Expand Down Expand Up @@ -394,7 +376,7 @@ date-fns@^1.23.0:
version "1.29.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6"

debug@*, debug@3.1.0, debug@^3.1.0:
debug@3.1.0, debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
Expand Down Expand Up @@ -669,11 +651,7 @@ lodash.templatesettings@^4.0.0:
dependencies:
lodash._reinterpolate "~3.0.0"

lodash@^4.17.4, lodash@^4.5.1:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"

lodash@^4.17.5:
lodash@^4.17.4, lodash@^4.17.5, lodash@^4.5.1:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"

Expand All @@ -685,8 +663,8 @@ lru-cache@^4.0.1:
yallist "^2.1.2"

make-error@^1.1.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.2.tgz#8762ffad2444dd8ff1f7c819629fa28e24fea1c4"
version "1.3.3"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.3.tgz#a97ae14ffd98b05f543e83ddc395e1b2b6e4cc6a"

minimatch@^3.0.4:
version "3.0.4"
Expand Down Expand Up @@ -861,10 +839,9 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"

stdout-stderr@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/stdout-stderr/-/stdout-stderr-0.1.6.tgz#82616602f639bf029c87ab1049b02640a39a18ba"
version "0.1.7"
resolved "https://registry.yarnpkg.com/stdout-stderr/-/stdout-stderr-0.1.7.tgz#f3f69391f3e721c2c52aa92fbfa18b8a6e9ce3df"
dependencies:
debug "*"
strip-ansi "^4.0.0"

string-width@^2.1.1:
Expand Down Expand Up @@ -969,11 +946,11 @@ tslib@^1.0.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"

tslint-consistent-codestyle@^1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/tslint-consistent-codestyle/-/tslint-consistent-codestyle-1.11.0.tgz#051493eeb3536a74e98d14b66f38028a785f8c2b"
version "1.11.1"
resolved "https://registry.yarnpkg.com/tslint-consistent-codestyle/-/tslint-consistent-codestyle-1.11.1.tgz#fa39ff5f5f8a25c537bd1e1f50de6190a2f4d70d"
dependencies:
tslib "^1.7.1"
tsutils "^2.12.2"
tsutils "^2.21.0"

tslint-eslint-rules@^4.1.1:
version "4.1.1"
Expand Down Expand Up @@ -1018,7 +995,7 @@ tsutils@^1.4.0:
version "1.9.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0"

tsutils@^2.12.1, tsutils@^2.12.2:
tsutils@^2.12.1, tsutils@^2.21.0:
version "2.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.21.0.tgz#43466a2283a0abce64e2209bc732ad72f8a04fab"
dependencies:
Expand Down

0 comments on commit 61a26af

Please sign in to comment.