-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84cdc81
commit d153a8d
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const _progress = require('../cli-progress'); | ||
|
||
// create a new progress bar with preset | ||
const bar = new _progress.Bar({ | ||
// green bar, reset styles after bar element | ||
format: ' >> [\u001b[32m{bar}\u001b[0m] {percentage}% | ETA: {eta}s | {value}/{total}', | ||
|
||
// same chars for bar elements, just separated by colors | ||
barCompleteChar: '#', | ||
barIncompleteChar: '#', | ||
|
||
// change color to yellow between bar complete/incomplete -> incomplete becomes yellow | ||
barGlue: '\u001b[33m' | ||
}); | ||
bar.start(200, 0); | ||
|
||
// random value 1..200 | ||
bar.update(Math.floor((Math.random() * 200) + 1)); | ||
bar.stop(); |