forked from filecoin-project/starling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
progress.js
53 lines (46 loc) · 936 Bytes
/
progress.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
43
44
45
46
47
48
49
50
51
52
53
const ProgressBar = require('progress');
const chalk = require('chalk');
function progress(total) {
const progressBar = new ProgressBar(
`${chalk.hex('#00E900')(':elapsed s [:bar] :percent')}`,
{
complete: '=',
incomplete: '-',
head: '>',
width: 40,
total: total
}
);
return progressBar;
}
function partialProgress(total) {
const progressBar = new ProgressBar(
`${chalk.hex('#F06201')(':elapsed [:bar] :percent')}`,
{
complete: '=',
incomplete: '-',
head: 'X',
width: 40,
total: total
}
);
return progressBar;
}
function failedProgress() {
const progressBar = new ProgressBar(
`${chalk.hex('#F90401')(':elapsed [:bar]')}`,
{
complete: '',
incomplete: '-',
head: 'x',
width: 40,
total: 40
}
);
return progressBar;
}
module.exports = {
progress,
partialProgress,
failedProgress
};