This commit is contained in:
Harvey committed 2022-04-28 10:00:21 +08:00
1 parent 5001490210
commit c4b4d4e7a8
34 files changed
+123 -281

No files matched your search

+10 -10
View File
@@ -1,27 +1,27 @@
const chalk = require('chalk');
const { format } = require('util');
import chalk from 'chalk';
import { format } from 'util';
const prefix = 'artplayer-cli';
const sep = chalk.gray('·');
exports.log = function log(...args) {
export function log(...args) {
const msg = format.apply(format, args);
console.log(chalk.white(prefix), sep, msg);
};
}
exports.fatal = function fatal(...args) {
export function fatal(...args) {
if (args[0] instanceof Error) args[0] = args[0].message.trim();
const msg = format.apply(format, args);
console.error(chalk.red(prefix), sep, msg);
process.exit(1);
};
}
exports.success = function success(...args) {
export function success(...args) {
const msg = format.apply(format, args);
console.log(chalk.green(prefix), sep, msg);
};
}
exports.warn = function warn(...args) {
export function warn(...args) {
const msg = format.apply(format, args);
console.log(chalk.yellow(prefix), sep, msg);
};
}