Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Supported Options:
* `total` - The total number of operations that _YOUR_ script will execute.
* `maxBurden` - The maximum 'burden' that the progress bar should incur. See more about burden below.
* `showBurden` - Mostly for debugging. Show the current burden / skipped steps with the other metrics.
* `itemType` - The type of item being processed, e.g. 'widgets'.

### pace.op([count]) ###
Signal to pace that an operation was completed in your script by calling
Expand Down
5 changes: 4 additions & 1 deletion pace.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ function Pace(options) {

// Whether to show current burden %.
this.show_burden = options.showBurden || false;

// Type of item, e.g. 'widgets'.
this.itemType = options.itemType || '';

// Internal time tracking properties.
this.started = false;
Expand Down Expand Up @@ -173,7 +176,7 @@ Pace.prototype.outputStats = function outputStats() {
this.charm.write(' ').display('bright').write(this.perc + '%').display('reset');
this.total_len = formatNumber(this.total).length;
this.charm.write(' ').display('bright').write(padLeft(formatNumber(this.current), this.total_len)).display('reset');
this.charm.write('/' + formatNumber(this.total));
this.charm.write('/' + formatNumber(this.total) + ' ' + this.itemType);

// Output burden.
if (this.show_burden) {
Expand Down