src/bin-utils/parser.js
function showHelp(specifiedScripts) {
    if (parsedArgv.help) {
      // if --help was specified, then yargs will show the default help
      log.info(help(psConfig))
      return true
    }
    const helpStyle = String(psConfig.options['help-style'])
    const hasDefaultScript = Boolean(psConfig.scripts.default)
    const noScriptSpecifiedAndNoDefault =
      !specifiedScripts.length && !hasDefaultScript
    const hasHelpScript = Boolean(psConfig.scripts.help)
    const commandIsHelp =
      isEqual(specifiedScripts[0], 'help') && !hasHelpScript
    const shouldShowSpecificScriptHelp =
      commandIsHelp && specifiedScripts.length > 1
    if (shouldShowSpecificScriptHelp) {
      log.info(specificHelpScript(psConfig, specifiedScripts[1]))
      return true
    } else if (commandIsHelp || noScriptSpecifiedAndNoDefault) {
      // Can't achieve 100% branch coverage without refactoring this showHelp()
      // function into ./index.js and re-working existing tests and such. Branch
      // options aren't relevant here either, so telling Istanbul to ignore.
      /* istanbul ignore next */
      if (helpStyle === 'all') {
        parser.showHelp('log')
      }
      log.info(help(psConfig))
      return true
    }

    return false
  }
function showHelp(specifiedScripts) {
    if (parsedArgv.help) {
      // if --help was specified, then yargs will show the default help
      log.info(help(psConfig))
      return true
    }
    const helpStyle = String(psConfig.options['help-style'])
    const hasDefaultScript = Boolean(psConfig.scripts.default)
    const noScriptSpecifiedAndNoDefault =
      !specifiedScripts.length && !hasDefaultScript
    const hasHelpScript = Boolean(psConfig.scripts.help)
    const commandIsHelp =
      isEqual(specifiedScripts[0], 'help') && !hasHelpScript
    const shouldShowSpecificScriptHelp =
      commandIsHelp && specifiedScripts.length > 1
    if (shouldShowSpecificScriptHelp) {
      log.info(specificHelpScript(psConfig, specifiedScripts[1]))
      return true
    } else if (commandIsHelp || noScriptSpecifiedAndNoDefault) {
      // Can't achieve 100% branch coverage without refactoring this showHelp()
      // function into ./index.js and re-working existing tests and such. Branch
      // options aren't relevant here either, so telling Istanbul to ignore.
      /* istanbul ignore next */
      if (helpStyle === 'all') {
        parser.showHelp('log')
      }
      log.info(help(psConfig))
      return true
    }

    return false
  }
function showHelp ( specifiedScripts ) { if ( parsedArgv . help ) { // if --help was specified, then yargs will show the default help log . info ( help ( psConfig ) ) return true } const helpStyle = String ( psConfig . options [ 'help-style' ] ) const hasDefaultScript = Boolean ( psConfig . scripts . default ) const noScriptSpecifiedAndNoDefault = ! specifiedScripts . length && ! hasDefaultScript const hasHelpScript = Boolean ( psConfig . scripts . help ) const commandIsHelp = isEqual ( specifiedScripts [ 0 ] , 'help' ) && ! hasHelpScript const shouldShowSpecificScriptHelp = commandIsHelp && specifiedScripts . length > 1 if ( shouldShowSpecificScriptHelp ) { log . info ( specificHelpScript ( psConfig , specifiedScripts [ 1 ] ) ) return true } else if ( commandIsHelp || noScriptSpecifiedAndNoDefault ) { // Can't achieve 100% branch coverage without refactoring this showHelp() // function into ./index.js and re-working existing tests and such. Branch // options aren't relevant here either, so telling Istanbul to ignore. /* istanbul ignore next */ if ( helpStyle === 'all' ) { parser . showHelp ( 'log' ) } log . info ( help ( psConfig ) ) return true } return false }
util functions eslint-disable-next-line complexity
util functions eslint - disable - next - line complexity