cli-progress
Advanced tools
Comparing version 3.8.1 to 3.8.2
## Branch 3.x ## | ||
### 3.8.2 ### | ||
* Bugfix: bar duration not stopped until all bars have finished - thanks to [omjadas on GitHub](https://github.com/AndiDittrich/Node.CLI-Progress/issues/71) | ||
### 3.8.1 ### | ||
@@ -4,0 +8,0 @@ |
@@ -24,6 +24,9 @@ const _stringWidth = require('string-width'); | ||
// bar stopped and stopTime set ? | ||
const stopTime = params.stopTime || Date.now(); | ||
// calculate elapsed time | ||
const elapsedTime = Math.round((Date.now() - params.startTime)/1000); | ||
const elapsedTime = Math.round((stopTime - params.startTime)/1000); | ||
// merges data from payload and calcuated | ||
// merges data from payload and calculated | ||
const context = Object.assign({}, payload, { | ||
@@ -30,0 +33,0 @@ bar: formatBar(params.progress, options), |
@@ -30,6 +30,9 @@ const _ETA = require('./eta'); | ||
// stop time (used for duration calculation) | ||
this.stopTime = null; | ||
// last update time | ||
this.lastRedraw = Date.now(); | ||
// default eta calulator (will be re-create on start) | ||
// default eta calculator (will be re-create on start) | ||
this.eta = new _ETA(this.options.etaBufferLength, 0, 0); | ||
@@ -65,2 +68,3 @@ | ||
startTime: this.startTime, | ||
stopTime: this.stopTime, | ||
total: this.total, | ||
@@ -113,5 +117,10 @@ value: this.value, | ||
this.total = (typeof total !== 'undefined' && total >= 0) ? total : 100; | ||
// store payload (optional) | ||
this.payload = payload || {}; | ||
// store start time for duration+eta calculation | ||
this.startTime = Date.now(); | ||
// reset string line buffer (redraw detection) | ||
this.lastDrawnString = ''; | ||
@@ -133,2 +142,5 @@ | ||
this.isActive = false; | ||
// store stop timestamp to get total duration | ||
this.stopTime = new Date(); | ||
@@ -135,0 +147,0 @@ // stop event |
@@ -54,3 +54,3 @@ const _Terminal = require('./terminal'); | ||
// disable line wrpaping ? | ||
// disable line wrapping ? | ||
if (this.options.linewrap === false){ | ||
@@ -57,0 +57,0 @@ this.terminal.lineWrapping(false); |
@@ -51,3 +51,3 @@ const _GenericBar = require('./generic-bar'); | ||
// trigger synchronous update ? | ||
// check for throttel time | ||
// check for throttle time | ||
if (this.options.synchronousUpdate && (this.lastRedraw + this.options.throttleTime*2) < Date.now()){ | ||
@@ -74,3 +74,3 @@ // force update | ||
// disable line wrpaping ? | ||
// disable line wrapping ? | ||
if (this.options.linewrap === false){ | ||
@@ -109,3 +109,3 @@ this.terminal.lineWrapping(false); | ||
// re-enable line wrpaping ? | ||
// re-enable line wrapping ? | ||
if (this.options.linewrap === false){ | ||
@@ -112,0 +112,0 @@ this.terminal.lineWrapping(true); |
{ | ||
"name": "cli-progress", | ||
"version": "3.8.1", | ||
"version": "3.8.2", | ||
"description": "easy to use progress-bar for command-line/terminal applications", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -248,3 +248,3 @@ [![Build Status](https://travis-ci.org/AndiDittrich/Node.CLI-Progress.svg?branch=master)](https://travis-ci.org/AndiDittrich/Node.CLI-Progress) | ||
- `autopadding` (type: boolean) - add padding chars to formatted time and percentage to force fixed width (default: false) - Note: handled standard format functions! | ||
- `autopaddingChar` (type: string) - the character sequence used for autopadding (default: " ") - Note: due to performance optimizations this value requies a length of 3 identical chars | ||
- `autopaddingChar` (type: string) - the character sequence used for autopadding (default: " ") - Note: due to performance optimizations this value requires a length of 3 identical chars | ||
- `formatBar` (type: function) - a custom bar formatter function which renders the bar-element (default: [format-bar.js](lib/format-bar.js)) | ||
@@ -259,3 +259,3 @@ - `formatTime` (type: function) - a custom timer formatter function which renders the formatted time elements like `eta_formatted` and `duration-formatted` (default: [format-time.js](lib/format-time.js)) | ||
See [event docs](docs/events.md) for detailed informations + examples. | ||
See [event docs](docs/events.md) for detailed information + examples. | ||
@@ -301,3 +301,3 @@ Bar Formatting | ||
// bar grows dynamically by current progrss - no whitespaces are added | ||
// bar grows dynamically by current progress - no whitespaces are added | ||
const bar = options.barCompleteString.substr(0, Math.round(params.progress*options.barsize)); | ||
@@ -429,3 +429,3 @@ | ||
**cli-progress** is designed for linux/macOS/container applications which mostly providing standard compliant tty terminals/shells. In non-tty mode it is suitible to be used with logging daemons (cyclic output). | ||
**cli-progress** is designed for linux/macOS/container applications which mostly providing standard compliant tty terminals/shells. In non-tty mode it is suitable to be used with logging daemons (cyclic output). | ||
@@ -432,0 +432,0 @@ It also works with PowerShell on Windows 10 - the legacy command prompt on outdated Windows versions won't work as expected and is not supported! |
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
54584
810