Skip to content
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

ProgressBar ETA is rendered as "infinity" #1056

Open
danielvy opened this issue Jun 10, 2024 · 0 comments
Open

ProgressBar ETA is rendered as "infinity" #1056

danielvy opened this issue Jun 10, 2024 · 0 comments

Comments

@danielvy
Copy link

When using :eta in a template, like:
':bar :rate/bps :percent :etas'

When the bar is started and current value is still zero, the :eta token is rendered as Infinity. This happens because the division by current zero in ProgressBar.ts:

/** Progress ETA (estimated time of arrival) */
  get ETA(): number {
    return this.percent === ProgressBar.MAX_PERCENT
      ? ProgressBar.MIN_PERCENT
      : this.elapsed * (this.total / this.#current - ProgressBar.MAX_RATIO);
  }

ProgressBar should not render eta value in this case, probably best to replace by constant zero.

I'm trying to replace Listr2 with tasktree (because Listr2 doesn't handle terminal height well, losing output - listr2/listr2#296). Thanks for the work on this library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant