MCPcopy Create free account
hub / github.com/npkgz/cli-progress / myFormatter

Function myFormatter

examples/example-formatter.js:4–16  ·  view source on GitHub ↗
(options, params, payload)

Source from the content-addressed store, hash-verified

2const _colors = require('ansi-colors');
3
4function myFormatter(options, params, payload){
5
6 // bar grows dynamically by current progrss - no whitespaces are added
7 const bar = options.barCompleteString.substr(0, Math.round(params.progress*options.barsize));
8
9 // end value reached ?
10 // change color to green when finished
11 if (params.value >= params.total){
12 return '# ' + _colors.grey(payload.task) + ' ' + _colors.green(params.value + '/' + params.total) + ' --[' + bar + ']-- ';
13 }else{
14 return '# ' + payload.task + ' ' + _colors.yellow(params.value + '/' + params.total) + ' --[' + bar + ']-- ';
15 }
16}
17
18function Example5(){
19 console.log('');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…