@ywfe/cli
Version:
遥望前端开发命令行工具
23 lines (22 loc) • 686 B
JavaScript
;
const chalk = require('chalk');
const format = require('util').format;
const prefix = ' ywfe-cli';
const fail = '错误';
const success = '成功';
const sep = chalk.gray(':');
exports.log = function () {
const msg = format.apply(format, arguments);
console.log(chalk.white(prefix), sep, msg);
};
exports.fatal = function (message) {
if (message instanceof Error)
message = message.message.trim();
const msg = format.apply(format, arguments);
console.error(chalk.red(fail), sep, msg);
process.exit(1);
};
exports.success = function () {
const msg = format.apply(format, arguments);
console.log(chalk.green(success), sep, msg);
};