1 | const chalk = require('chalk')
|
2 | const format = require('util').format
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | const prefix = ' angu-cli'
|
9 | const sep = chalk.gray('·')
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | exports.log = function (...args) {
|
18 | const msg = format.apply(format, args)
|
19 | console.log(chalk.white(prefix), sep, msg)
|
20 | }
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | exports.fatal = function (...args) {
|
29 | if (args[0] instanceof Error) args[0] = args[0].message.trim()
|
30 | const msg = format.apply(format, args)
|
31 | console.error(chalk.red(prefix), sep, msg)
|
32 | process.exit(1)
|
33 | }
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | exports.success = function (...args) {
|
42 | const msg = format.apply(format, args)
|
43 | console.log(chalk.white(prefix), sep, msg)
|
44 | }
|