Skip to content

ProgressBar ETA is rendered as "infinity" #1056

@danielvy

Description

@danielvy

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions