-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPBar.js
36 lines (32 loc) · 844 Bytes
/
PBar.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
const c = require("ansi-colors");
const progress = require("progress");
const data = require("./data.js");
class PBar {
constructor(len=10) {
this.bar = new progress(':bar ' +
c.cyan(':percent ') +
':etas ' +
c.red(':numerr errors ') +
c.yellow(':numwarn warnings ') +
':fname ' +
c.grey(':mesg'), {
complete: c.cyan('█'),
incomplete: c.cyan('░'),
width: 40,
total: len,
clear: true, // clear after done
});
}
text(mesg) {
this.bar.tick(0, {
mesg,
fname: data.current_file,
numerr: data.errors.length,
numwarn: data.warnings.length,
});
}
tick() {
this.bar.tick();
}
}
module.exports = PBar;