Skip to content

Commit d93f29a

Browse files
authoredMar 25, 2025··
BREAKING(cli/unstable): remove trailing whitespaces from ProgressBarFormatter properties (#6502)
initial commit
1 parent 1c1ba46 commit d93f29a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎cli/unstable_progress_bar.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
export interface ProgressBarFormatter {
88
/**
99
* A function that returns a formatted version of the duration.
10-
* `[mm:ss] `
10+
* `[mm:ss]`
1111
*/
1212
styledTime: () => string;
1313
/**
1414
* A function that returns a formatted version of the data received.
15-
* `[0.40/97.66 KiB] `
15+
* `[0.40/97.66 KiB]`
1616
* @param fractions The number of decimal places the values should have.
1717
*/
1818
styledData: (fractions?: number) => string;
1919
/**
2020
* The progress bar string.
21-
* Default Style: `[###-------] `
21+
* Default Style: `[###-------]`
2222
*/
2323
progressBar: string;
2424
/**
@@ -172,7 +172,7 @@ export class ProgressBar {
172172
fillChar = "#",
173173
emptyChar = "-",
174174
clear = false,
175-
fmt = (x) => x.styledTime() + x.progressBar + x.styledData(),
175+
fmt = (x) => `${x.styledTime()} ${x.progressBar} ${x.styledData()} `,
176176
keepOpen = true,
177177
} = options;
178178
this.#value = value;
@@ -223,14 +223,14 @@ export class ProgressBar {
223223
styledTime() {
224224
const minutes = (this.time / 1000 / 60 | 0).toString().padStart(2, "0");
225225
const seconds = (this.time / 1000 % 60 | 0).toString().padStart(2, "0");
226-
return `[${minutes}:${seconds}] `;
226+
return `[${minutes}:${seconds}]`;
227227
},
228228
styledData: (fractions = 2): string => {
229229
const currentValue = (this.#value / this.#rate).toFixed(fractions);
230230
const maxValue = (this.#max / this.#rate).toFixed(fractions);
231-
return `[${currentValue}/${maxValue} ${this.#unit}] `;
231+
return `[${currentValue}/${maxValue} ${this.#unit}]`;
232232
},
233-
progressBar: `[${fillChars}${emptyChars}] `,
233+
progressBar: `[${fillChars}${emptyChars}]`,
234234
time: currentTime - this.#startTime,
235235
previousTime: this.#lastTime - this.#startTime,
236236
value: this.#value,

0 commit comments

Comments
 (0)
Please sign in to comment.