mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-15 09:06:16 -08:00
完成dev脚本
This commit is contained in:
1 parent
c2bbe15e79
commit
cc2027832e
7 files changed
+118
-12
No files matched your search
@@ -0,0 +1,27 @@
|
||||
const chalk = require('chalk');
|
||||
const { format } = require('util');
|
||||
|
||||
const prefix = 'artplayer-cli';
|
||||
const sep = chalk.gray('·');
|
||||
|
||||
exports.log = function log(...args) {
|
||||
const msg = format.apply(format, args);
|
||||
console.log(chalk.white(prefix), sep, msg);
|
||||
};
|
||||
|
||||
exports.fatal = 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) {
|
||||
const msg = format.apply(format, args);
|
||||
console.log(chalk.green(prefix), sep, msg);
|
||||
};
|
||||
|
||||
exports.warn = function warn(...args) {
|
||||
const msg = format.apply(format, args);
|
||||
console.log(chalk.yellow(prefix), sep, msg);
|
||||
};
|
||||
Reference in new issue
Block a user