Skip to content

BREAKING(cli/unstable): rename ProgressBar end() method to stop() #6406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion cli/unstable_progress_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class ProgressBar {
* await progressBar.end()
* ```
*/
async end(): Promise<void> {
async stop(): Promise<void> {
clearInterval(this.#id);
await this.#print()
.then(() => this.#writer.write(this.#clear ? "\r\u001b[K" : "\n"))
Expand Down
4 changes: 2 additions & 2 deletions cli/unstable_progress_bar_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export class ProgressBarStream extends TransformStream<Uint8Array, Uint8Array> {
controller.enqueue(chunk);
},
flush(_controller) {
bar?.end();
bar?.stop();
},
cancel() {
bar?.end();
bar?.stop();
},
});
}
Expand Down
10 changes: 5 additions & 5 deletions cli/unstable_progress_bar_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Deno.test("ProgressBar() outputs default result", async () => {
const bar = new ProgressBar(writable, { max: 10 * 1000 });

for await (const a of getData(10, 1000)) bar.add(a.length);
bar.end().then(() => writable.close());
bar.stop().then(() => writable.close());

for await (const buffer of readable) {
if (buffer.length == 1) {
Expand Down Expand Up @@ -67,7 +67,7 @@ Deno.test("ProgressBar() can handle a readable.cancel() correctly", async () =>
const bar = new ProgressBar(writable, { max: 10 * 1000 });

for await (const a of getData(10, 1000)) bar.add(a.length);
bar.end();
bar.stop();

await readable.cancel();
});
Expand All @@ -80,7 +80,7 @@ Deno.test("ProgressBar() can remove itself when finished", async () => {
});

for await (const a of getData(10, 1000)) bar.add(a.length);
bar.end()
bar.stop()
.then(() => writable.close());

for await (const buffer of readable) {
Expand All @@ -105,7 +105,7 @@ Deno.test("ProgressBar() passes correct values to formatter", async () => {
});

for await (const a of getData(10, 1000)) bar.add(a.length);
bar.end();
bar.stop();

await new Response(readable).bytes();
});
Expand All @@ -125,6 +125,6 @@ Deno.test("ProgressBar() uses correct unit type", async () => {
assertEquals(decoder.decode(buffer.subarray(-5, -2)), unit);
break;
}
bar.end();
bar.stop();
}
});
Loading