cli-progress icon indicating copy to clipboard operation
cli-progress copied to clipboard

In high frequency updates the loader shows up in between multibar logs

Open saikatmitra91 opened this issue 1 year ago • 2 comments

Code Snippet

const cliProgress = require("cli-progress");
const ProgressBar = cliProgress.MultiBar;

const multi = new ProgressBar({
  format:
    "Progress |" +
    "{bar}" +
    "| {percentage}% || {value}/{total} Chunks || Speed: {speed} || ETA: {eta}s",
  hideCursor: true,
  barCompleteChar: '\u2588',
    barIncompleteChar: '\u2591',
    clearOnComplete: true,
    stopOnComplete: true,
    forceRedraw: true
});

const bar1 = multi.create(100, 0);
const bar2 = multi.create(100, 0)

let i = 0;
const interval = setInterval(() => {
  // Simulate some process
  i++;

  // Print logs
  multi.log(`Log message ${i} \n`);

  // Update progress bar
  bar1.update(i);
  bar2.update(i);

  if (i === 100) {
    clearInterval(interval);
    multi.stop();
    console.log("All items processed!");
  }
}, 10);

Output Screenshot 2024-04-10 at 5 27 19 PM

Expected

Screenshot 2024-04-10 at 5 32 26 PM

The logs should be clean with progress bar cleanly appearing at the bottom

please let me know If there is a way to mitigate this issue

saikatmitra91 avatar Apr 10 '24 12:04 saikatmitra91

I think you want this module:

https://www.npmjs.com/package/log-update

numtel avatar Jun 21 '24 03:06 numtel

I think you want this module:

https://www.npmjs.com/package/log-update

Stop that dude...

yaneony avatar Sep 24 '25 17:09 yaneony