cli-progress
cli-progress copied to clipboard
Incorrect MultiBar.remove behaviour
import cliProgress from "cli-progress";
// create new container
const multibar = new cliProgress.MultiBar(
{
clearOnComplete: false,
hideCursor: true,
format: " {bar} | {filename} | {value}/{total}",
},
cliProgress.Presets.shades_grey
);
const b1 = multibar.create(200, 0);
const b2 = multibar.create(1000, 0);
b1.update(0, { filename: "Task 1 in progress" });
b2.update(0, { filename: "Task 2 in progress" });
setTimeout(() => {
// Task 1 completed, remove bar.
multibar.remove(b1);
}, 1000);
Expected behaviour: After 1 second only 'Task 2 in progress' caption should left on screen. Actual behaviour: After 1 second 'Task 1 in progress' caption is still on screen, but 'Task 2 in progress' removed instead.
just set clearOnComplete to true
@AndiDittrich
import cliProgress from "cli-progress";
// create new container
const multibar = new cliProgress.MultiBar(
{
clearOnComplete: true,
hideCursor: true,
format: " {bar} | {filename} | {value}/{total}",
},
cliProgress.Presets.shades_grey
);
const b1 = multibar.create(200, 0, { clearOnComplete: true });
const b2 = multibar.create(1000, 0, { clearOnComplete: true });
b1.update(0, { filename: "Task 1 in progress" });
b2.update(0, { filename: "Task 2 in progress" });
setTimeout(() => {
// Task 1 completed, remove bar.
multibar.remove(b1);
}, 1000);
Seems like nothing has changed. Btw i'm using Windows Terminal, if it matters.
clearOnComplete clears the screen only when all of the children bars are completed.
But in my case i want only one of bars to be removed, not waiting for others to complete.
I already fixed this in attached PR. Could you please merge it?