mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-13 19:01:25 -06:00
15 lines
375 B
JavaScript
15 lines
375 B
JavaScript
const program = require('commander')
|
|
const chalk = require('chalk')
|
|
|
|
module.exports = (methodName, log) => {
|
|
program.Command.prototype[methodName] = function (...args) {
|
|
if (methodName === 'unknownOption' && this._allowUnknownOption) {
|
|
return
|
|
}
|
|
this.outputHelp()
|
|
console.log(` ` + chalk.red(log(...args)))
|
|
console.log()
|
|
process.exit(1)
|
|
}
|
|
}
|