enhanceErrorMessages.js 395 B

1234567891011121314
  1. const program = require('commander')
  2. const { chalk } = require('@vue/cli-shared-utils')
  3. module.exports = (methodName, log) => {
  4. program.Command.prototype[methodName] = function (...args) {
  5. if (methodName === 'unknownOption' && this._allowUnknownOption) {
  6. return
  7. }
  8. this.outputHelp()
  9. console.log(` ` + chalk.red(log(...args)))
  10. console.log()
  11. process.exit(1)
  12. }
  13. }