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