cli-progress
Advanced tools
Comparing version 3.6.0 to 3.6.1
## Branch 3.x ## | ||
### 3.6.1 ### | ||
* Bugfix: bar initialization overrides options within all instances - thanks to [BigBrainAFK on GitHub](https://github.com/AndiDittrich/Node.CLI-Progress/issues/64) | ||
### 3.6.0 ### | ||
@@ -4,0 +8,0 @@ |
@@ -1,4 +0,1 @@ | ||
// global options storage | ||
const _options = {}; | ||
// utility to merge defaults | ||
@@ -17,2 +14,5 @@ function mergeOption(v, defaultValue){ | ||
// options storage | ||
const options = {}; | ||
// merge preset | ||
@@ -22,78 +22,73 @@ const opt = Object.assign({}, preset, rawOptions); | ||
// the max update rate in fps (redraw will only triggered on value change) | ||
_options.throttleTime = 1000 / (mergeOption(opt.fps, 10)); | ||
options.throttleTime = 1000 / (mergeOption(opt.fps, 10)); | ||
// the output stream to write on | ||
_options.stream = mergeOption(opt.stream, process.stderr); | ||
options.stream = mergeOption(opt.stream, process.stderr); | ||
// external terminal provided ? | ||
_options.terminal = mergeOption(opt.terminal, null); | ||
options.terminal = mergeOption(opt.terminal, null); | ||
// clear on finish ? | ||
_options.clearOnComplete = mergeOption(opt.clearOnComplete, false); | ||
options.clearOnComplete = mergeOption(opt.clearOnComplete, false); | ||
// stop on finish ? | ||
_options.stopOnComplete = mergeOption(opt.stopOnComplete, false); | ||
options.stopOnComplete = mergeOption(opt.stopOnComplete, false); | ||
// size of the progressbar in chars | ||
_options.barsize = mergeOption(opt.barsize, 40); | ||
options.barsize = mergeOption(opt.barsize, 40); | ||
// position of the progress bar - 'left' (default), 'right' or 'center' | ||
_options.align = mergeOption(opt.align, 'left'); | ||
options.align = mergeOption(opt.align, 'left'); | ||
// hide the cursor ? | ||
_options.hideCursor = mergeOption(opt.hideCursor, false); | ||
options.hideCursor = mergeOption(opt.hideCursor, false); | ||
// disable linewrapping ? | ||
_options.linewrap = mergeOption(opt.linewrap, false); | ||
options.linewrap = mergeOption(opt.linewrap, false); | ||
// pre-render bar strings (performance) | ||
_options.barCompleteString = (new Array(_options.barsize + 1 ).join(opt.barCompleteChar || '=')); | ||
_options.barIncompleteString = (new Array(_options.barsize + 1 ).join(opt.barIncompleteChar || '-')); | ||
options.barCompleteString = (new Array(options.barsize + 1 ).join(opt.barCompleteChar || '=')); | ||
options.barIncompleteString = (new Array(options.barsize + 1 ).join(opt.barIncompleteChar || '-')); | ||
// glue sequence (control chars) between bar elements ? | ||
_options.barGlue = mergeOption(opt.barGlue, ''); | ||
options.barGlue = mergeOption(opt.barGlue, ''); | ||
// the bar format | ||
_options.format = mergeOption(opt.format, 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'); | ||
options.format = mergeOption(opt.format, 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'); | ||
// external time-format provided ? | ||
_options.formatTime = mergeOption(opt.formatTime, null); | ||
options.formatTime = mergeOption(opt.formatTime, null); | ||
// external value-format provided ? | ||
_options.formatValue = mergeOption(opt.formatValue, null); | ||
options.formatValue = mergeOption(opt.formatValue, null); | ||
// external bar-format provided ? | ||
_options.formatBar = mergeOption(opt.formatBar, null); | ||
options.formatBar = mergeOption(opt.formatBar, null); | ||
// the number of results to average ETA over | ||
_options.etaBufferLength = mergeOption(opt.etaBuffer, 10); | ||
options.etaBufferLength = mergeOption(opt.etaBuffer, 10); | ||
// allow synchronous updates ? | ||
_options.synchronousUpdate = mergeOption(opt.synchronousUpdate, true); | ||
options.synchronousUpdate = mergeOption(opt.synchronousUpdate, true); | ||
// notty mode | ||
_options.noTTYOutput = mergeOption(opt.noTTYOutput, false); | ||
options.noTTYOutput = mergeOption(opt.noTTYOutput, false); | ||
// schedule - 2s | ||
_options.notTTYSchedule = mergeOption(opt.notTTYSchedule, 2000); | ||
options.notTTYSchedule = mergeOption(opt.notTTYSchedule, 2000); | ||
// emptyOnZero - false | ||
_options.emptyOnZero = mergeOption(opt.emptyOnZero, false); | ||
options.emptyOnZero = mergeOption(opt.emptyOnZero, false); | ||
// force bar redraw even if progress did not change | ||
_options.forceRedraw = mergeOption(opt.forceRedraw, false); | ||
options.forceRedraw = mergeOption(opt.forceRedraw, false); | ||
// automated padding to fixed width ? | ||
_options.autopadding = mergeOption(opt.autopadding, false); | ||
options.autopadding = mergeOption(opt.autopadding, false); | ||
// autopadding character - empty in case autopadding is disabled | ||
_options.autopaddingChar = _options.autopadding ? mergeOption(opt.autopaddingChar, ' ') : ''; | ||
options.autopaddingChar = options.autopadding ? mergeOption(opt.autopaddingChar, ' ') : ''; | ||
return _options; | ||
}, | ||
// fetch all options | ||
getOptions: function getOptions(){ | ||
return _options; | ||
return options; | ||
} | ||
}; |
{ | ||
"name": "cli-progress", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"description": "easy to use progress-bar for command-line/terminal applications", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"colors": "^1.1.2", | ||
"string-width": "^2.1.1" | ||
"string-width": "^4.2.0" | ||
}, | ||
@@ -45,4 +45,4 @@ "devDependencies": { | ||
"eslint-config-aenondynamics": "^0.2.0", | ||
"mocha": "^6.2.1" | ||
"mocha": "^7.1.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50926
773
+ Addedansi-regex@5.0.1(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
- Removedansi-regex@3.0.1(transitive)
- Removedis-fullwidth-code-point@2.0.0(transitive)
- Removedstring-width@2.1.1(transitive)
- Removedstrip-ansi@4.0.0(transitive)
Updatedstring-width@^4.2.0