-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (33 loc) · 984 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Colors output to the console using escape codes.
* https://en.wikipedia.org/wiki/ANSI_escape_code
*
* @param {object}
*/
var banner = require('./banner');
module.exports = {
log: function () {
console.log('\x1b[32m', Array.prototype.slice.call(arguments).join(' ') ,'\x1b[0m');
},
info: function () {
console.log(Array.prototype.slice.call(arguments).join(' '));
},
error: function () {
console.log('\x1b[31m', Array.prototype.slice.call(arguments).join(' ') ,'\x1b[0m');
},
warn: function () {
console.log('\x1b[33m', Array.prototype.slice.call(arguments).join(' ') ,'\x1b[0m');
},
/** Returns a horizontal rule. */
hr: function() {
return repeat(null, ((process.stdout.isTTY) ? process.stdout.columns : 33)-3);
},
makeBanner: function(text) {
return banner.plot(text);
}
};
var repeat = function(chr, count) {
var chr = chr || '-';
var count = count || 20;
return Array(count+1).join(chr);
};