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

Commit

Permalink
fix(help): --no-install help text was contradicting itself
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Jul 9, 2017
1 parent fc316ac commit 9d96f5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function getExistingPath (command, opts) {
} else {
return which(command).catch(err => {
if (err.code === 'ENOENT') {
if (!opts.install) {
if (opts.install === false) {
err.exitCode = 127
throw err
}
Expand Down
13 changes: 8 additions & 5 deletions parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ function parseArgs (argv, defaultNpm) {
hasDashDash = true
break
} else if (opt[0] === '-') {
if (!bools.has(opt.replace(/^--?(no-)?/i, ''))) {
if (
// --no-install needs to be special-cased because we're abusing
// yargs a bit in order to get the --help text right.
opt !== '--no-install' &&
!bools.has(opt.replace(/^--?(no-)?/i, ''))
) {
i++
}
} else {
Expand Down Expand Up @@ -112,7 +117,6 @@ function fastPathArgs (argv, defaultNpm) {
package: pkg,
p: pkg,
shell: false,
install: true,
noYargs: true,
npm: defaultNpm || 'npm'
}
Expand Down Expand Up @@ -171,10 +175,9 @@ function yargsParser (argv, defaultNpm) {
type: 'string',
describe: Y()`Location of the npm cache.`
})
.option('install', {
.option('no-install', {
type: 'boolean',
describe: Y()`Skip installation if a package is missing.`,
default: true
describe: Y()`Skip installation if a package is missing.`
})
.option('userconfig', {
type: 'string',
Expand Down

0 comments on commit 9d96f5e

Please sign in to comment.