lib/utils/enhance-error-messages.js
function enhanceErrorMessages (method, log) {
  program.Command.prototype[method] = function (argument) {
    if (method === 'unknownOption' && this._allowUnknownOption) {
      return
    }

    this.outputHelp()
    console.log(chalk`\n{red ${log(argument)}}`)
    process.exit(1)
  }
}
function enhanceErrorMessages (method, log) {
  program.Command.prototype[method] = function (argument) {
    if (method === 'unknownOption' && this._allowUnknownOption) {
      return
    }

    this.outputHelp()
    console.log(chalk`\n{red ${log(argument)}}`)
    process.exit(1)
  }
}
function enhanceErrorMessages ( method , log ) { program . Command . prototype [ method ] = function ( argument ) { if ( method === 'unknownOption' && this . _allowUnknownOption ) { return } this . outputHelp ( ) console . log ( chalk ` \n ${ log ( argument ) } ` ) process . exit ( 1 ) } }
Enhance Commander.js error message with more useful help
Inspired by Vue CLI
@see {@link https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/enhanceErrorMessages.js | Source on GitHub}
@param {string} method Commander.js method name
@param {Function} log Error message callback (returns a string)
Enhance Commander . js error message with more useful help Inspired by Vue CLI