oclif/cli-ux

cli.progress creating a new line on each update

jacquesfu opened this issue · 0 comments

running one of the examples from the cli.progress repo results in each update to the bar graph showing up as a separate line instead of updating the existing line.

progress [----------------------------------------] 1% | ETA: 15s | 1/100
progress [==--------------------------------------] 5% | ETA: 5s | 5/100
progress [====------------------------------------] 10% | ETA: 2s | 10/100
progress [======----------------------------------] 14% | ETA: 3s | 14/100
progress [=======---------------------------------] 18% | ETA: 2s | 18/100
progress [=========-------------------------------] 23% | ETA: 2s | 23/100

sample code:

    const bar = cli.progress();
    bar.start();
    let value = 0;
    const timer = setInterval(() => {
      value++;

      // update the bar value
      bar.update(value);
      if (value >= bar.getTotal()) {
        // stop timer
        clearInterval(timer);

        bar.stop();
      }
    }, 20);