cloggi 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare class ClogBuilder {
27
27
  success(text: number | string | object): this;
28
28
  warning(text: number | string | object): this;
29
29
  sep(a?: number | string, b?: number | string): this;
30
- progress(text: number | string | object): this;
30
+ progress(message: number | string | object, total: number, current: number): this;
31
31
  }
32
32
  type Cloggi = ClogBuilder & ((text: number | string | object) => void);
33
33
  export declare const cloggi: Cloggi;
package/dist/index.js CHANGED
@@ -128,11 +128,16 @@ class ClogBuilder {
128
128
  const char = typeof a === 'string' ? a : typeof b === 'string' ? b : '-';
129
129
  return this._print(char.repeat(length));
130
130
  }
131
- progress(text) {
131
+ progress(message, total, current) {
132
132
  this._overwrite = true;
133
133
  this._timed = true;
134
134
  this._color = 'cyan';
135
- return this._print(text);
135
+ const percentage = ((current / total) * 100).toFixed(2);
136
+ const progressBarLength = 50;
137
+ const filledLength = Math.round((current / total) * progressBarLength);
138
+ const bar = '█'.repeat(filledLength) + '-'.repeat(progressBarLength - filledLength);
139
+ const fullMessage = `${message}\n|${bar}| ${percentage}%\n${current} of ${total}`;
140
+ return this._print(fullMessage);
136
141
  }
137
142
  }
138
143
  const wrapInstance = (instance) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloggi",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "author": "Claudio Santancini",
5
5
  "description": "cloggish!",
6
6
  "main": "dist/index.js",