UNPKG

wpsjs

Version:

用于开发wps加载项的工具包

15 lines (13 loc) 389 B
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) } }