Skip to content

Commit c487ea0

Browse files
author
Kent C. Dodds
committed
fix(bin): only show help when it should
As noted by @boneskull. Commit a70e9a8 caused p-s to always output the `help` unless you had a truthy help script configured Thanks for the report @boneskull
1 parent 5bb0ed4 commit c487ea0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bin/p-s.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ if (shouldAutocomplete) {
3939
const hasDefaultScript = !!psConfig.scripts.default
4040
const scriptsAndArgs = getScriptsAndArgs(program)
4141
const hasHelpScript = !!psConfig.scripts.help
42-
if (!hasDefaultScript && scriptsAndArgs.scripts.length < 1) {
42+
const scriptIsHelp = scriptsAndArgs.scripts[0] === 'help'
43+
const scriptSpecified = scriptsAndArgs.scripts.length >= 1
44+
if (!hasDefaultScript && !scriptSpecified) {
4345
program.outputHelp()
44-
} else if (!hasHelpScript) { // eslint-disable-line no-negated-condition
46+
} else if (!hasHelpScript && scriptIsHelp) { // eslint-disable-line no-negated-condition
4547
program.outputHelp()
4648
} else {
4749
loadAndRun(scriptsAndArgs, psConfig)

0 commit comments

Comments
 (0)