Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Commit

Permalink
fix(help): correctly enable -h and --help
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Jun 3, 2017
1 parent a5fbdaf commit adc2f45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const path = require('path')
const pkg = require('./package.json')
const updateNotifier = require('update-notifier')
const which = BB.promisify(require('which'))
const yargs = require('yargs')

const PATH_SEP = process.platform === 'win32' ? ';' : ':'

Expand All @@ -33,7 +32,7 @@ function main (argv) {

if (!argv.command || !argv.package) {
console.error('\nERROR: You must supply a command.\n')
yargs.showHelp()
parseArgs.showHelp()
process.exit(1)
}

Expand Down
4 changes: 4 additions & 0 deletions parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function parseArgs (argv) {
})
.version()
.alias('version', 'v')
.help()
.alias('help', 'h')

const opts = parser.getOptions()
const bools = new Set(opts.boolean)
Expand Down Expand Up @@ -119,6 +121,8 @@ function parseArgs (argv) {
}
}

parseArgs.showHelp = () => yargs.showHelp()

module.exports._guessCmdName = guessCmdName
function guessCmdName (spec) {
if (typeof spec === 'string') { spec = npa(spec) }
Expand Down

0 comments on commit adc2f45

Please sign in to comment.