Skip to content

Commit

Permalink
Use H for host option short flag. (#247)
Browse files Browse the repository at this point in the history
Fixes subcommand help display (`-h`).
Add program help text to show subcommand help.
  • Loading branch information
alampros authored and KyleAMathews committed Apr 18, 2016
1 parent 61ee2fb commit cf1794f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ program

program.command('develop')
.description('Start development server. Watches files and rebuilds and hot reloads if something changes') // eslint-disable-line max-len
.option('-h, --host <url>',
.option('-H, --host <url>',
`Set host. Defaults to ${defaultHost}`,
defaultHost
)
Expand Down Expand Up @@ -57,7 +57,7 @@ program.command('build')

program.command('serve-build')
.description('Serve built site.')
.option('-h, --host <url>',
.option('-H, --host <url>',
`Set host. Defaults to ${defaultHost}`,
defaultHost
)
Expand All @@ -80,6 +80,12 @@ program
newCommand(rootPath, starter)
})

program.on('--help', () => {
console.log(`To show subcommand help:
gatsby [command] -h
`)
})

// If the user types an unknown sub-command, just display the help.
const subCmd = process.argv.slice(2, 3)[0]
Expand Down

0 comments on commit cf1794f

Please sign in to comment.