Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
fix(help): prints subcmd menu correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Garant committed Jan 9, 2019
1 parent 86543c6 commit 3225516
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

// -- Requires -------------------------------------------------------------------------------------

// export const hi = 'hi'

import * as async from 'async'
import * as fs from 'fs'
import * as nopt from 'nopt'
Expand Down
13 changes: 4 additions & 9 deletions src/cmds/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,22 @@ Help.prototype.listFlags_ = function(command) {
Help.prototype.listCommands_ = function(commands) {
let content =
'usage: gh <command> [payload] [--flags] [--verbose] [--no-color] [--no-hooks]\n\n'
let pos
let command

content += 'List of available commands:\n'

for (pos in commands) {
if (commands.hasOwnProperty(pos)) {
command = commands[pos]
commands.forEach(command => {
if (command && command.hasOwnProperty('alias')) {
content += ' '

if (command.alias) {
content += `${logger.colors.magenta(command.alias)}, `
}
content += `${logger.colors.magenta(command.alias)}, `

content += `${logger.colors.magenta(command.name)}${command.offset}${
command.description
}\n`

content += this.listFlags_(command)
}
}
})

content += `\n(*) Flags that can execute an action.\n'gh help' lists available commands.\n'gh help -a' lists all available subcommands.`

Expand Down

0 comments on commit 3225516

Please sign in to comment.