UNPKG

daruk-cli

Version:
23 lines (18 loc) 590 B
const chalk = require('chalk') const format = require('util').format const prefix = ' daruk-cli' const sep = chalk.gray('·') exports.fatal = function (...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.log = function (...args) { const msg = format.apply(format, args) console.log(chalk.white(prefix), sep, msg) } exports.success = function (...args) { const msg = format.apply(format, args) console.log(chalk.white(prefix), sep, msg) }